DBusInterface::DBusInterface() :
QObject()
{
- QDBusConnection::sessionBus().registerService("org.freedesktop.FileManager1");
- QDBusConnection::sessionBus().registerObject("/org/freedesktop/FileManager1", this,
+ QDBusConnection::sessionBus().registerService(QStringLiteral("org.freedesktop.FileManager1"));
+ QDBusConnection::sessionBus().registerObject(QStringLiteral("/org/freedesktop/FileManager1"), this,
QDBusConnection::ExportScriptableContents | QDBusConnection::ExportAdaptors);
}
if (urls.isEmpty()) {
return;
}
- KRun::run("dolphin %u", urls, nullptr);
+ KRun::run(QStringLiteral("dolphin %u"), urls, nullptr);
}
void DBusInterface::ShowItems(const QStringList& uriList, const QString& startUpId)
if (urls.isEmpty()) {
return;
}
- KRun::run("dolphin --select %u", urls, nullptr);
+ KRun::run(QStringLiteral("dolphin --select %u"), urls, nullptr);
}
void DBusInterface::ShowItemProperties(const QStringList& uriList, const QString& startUpId)
{
Q_ASSERT(m_context & TrashContext);
- QAction* emptyTrashAction = new QAction(QIcon::fromTheme("trash-empty"), i18nc("@action:inmenu", "Empty Trash"), this);
- KConfig trashConfig("trashrc", KConfig::SimpleConfig);
+ QAction* emptyTrashAction = new QAction(QIcon::fromTheme(QStringLiteral("trash-empty")), i18nc("@action:inmenu", "Empty Trash"), this);
+ KConfig trashConfig(QStringLiteral("trashrc"), KConfig::SimpleConfig);
emptyTrashAction->setEnabled(!trashConfig.group("Status").readEntry("Empty", true));
addAction(emptyTrashAction);
addCustomActions();
- QAction* propertiesAction = m_mainWindow->actionCollection()->action("properties");
+ QAction* propertiesAction = m_mainWindow->actionCollection()->action(QStringLiteral("properties"));
addAction(propertiesAction);
addShowMenuBarAction();
QAction* restoreAction = new QAction(i18nc("@action:inmenu", "Restore"), m_mainWindow);
addAction(restoreAction);
- QAction* deleteAction = m_mainWindow->actionCollection()->action("delete");
+ QAction* deleteAction = m_mainWindow->actionCollection()->action(QStringLiteral("delete"));
addAction(deleteAction);
- QAction* propertiesAction = m_mainWindow->actionCollection()->action("properties");
+ QAction* propertiesAction = m_mainWindow->actionCollection()->action(QStringLiteral("properties"));
addAction(propertiesAction);
if (exec(m_pos) == restoreAction) {
QList<QUrl> selectedUrls;
+ selectedUrls.reserve(m_selectedItems.count());
foreach (const KFileItem &item, m_selectedItems) {
selectedUrls.append(item.url());
}
QMenu* menu = newFileMenu->menu();
menu->setTitle(i18nc("@title:menu Create new folder, file, link, etc.", "Create New"));
- menu->setIcon(QIcon::fromTheme("document-new"));
+ menu->setIcon(QIcon::fromTheme(QStringLiteral("document-new")));
addMenu(menu);
addSeparator();
// insert 'Open in new window' and 'Open in new tab' entries
- addAction(m_mainWindow->actionCollection()->action("open_in_new_window"));
- addAction(m_mainWindow->actionCollection()->action("open_in_new_tab"));
+ addAction(m_mainWindow->actionCollection()->action(QStringLiteral("open_in_new_window")));
+ addAction(m_mainWindow->actionCollection()->action(QStringLiteral("open_in_new_tab")));
// insert 'Add to Places' entry
if (!placeExists(m_fileInfo.url())) {
- addToPlacesAction = addAction(QIcon::fromTheme("bookmark-new"),
+ addToPlacesAction = addAction(QIcon::fromTheme(QStringLiteral("bookmark-new")),
i18nc("@action:inmenu Add selected folder to places",
"Add to Places"));
}
addSeparator();
- } else if (m_baseUrl.scheme().contains("search") || m_baseUrl.scheme().contains("timeline")) {
- openParentAction = new QAction(QIcon::fromTheme("document-open-folder"),
+ } else if (m_baseUrl.scheme().contains(QStringLiteral("search")) || m_baseUrl.scheme().contains(QStringLiteral("timeline"))) {
+ openParentAction = new QAction(QIcon::fromTheme(QStringLiteral("document-open-folder")),
i18nc("@action:inmenu",
"Open Path"),
this);
addAction(openParentAction);
- openParentInNewWindowAction = new QAction(QIcon::fromTheme("window-new"),
+ openParentInNewWindowAction = new QAction(QIcon::fromTheme(QStringLiteral("window-new")),
i18nc("@action:inmenu",
"Open Path in New Window"),
this);
addAction(openParentInNewWindowAction);
- openParentInNewTabAction = new QAction(QIcon::fromTheme("tab-new"),
+ openParentInNewTabAction = new QAction(QIcon::fromTheme(QStringLiteral("tab-new")),
i18nc("@action:inmenu",
"Open Path in New Tab"),
this);
addSeparator();
} else if (!DolphinView::openItemAsFolderUrl(m_fileInfo).isEmpty()) {
// insert 'Open in new window' and 'Open in new tab' entries
- addAction(m_mainWindow->actionCollection()->action("open_in_new_window"));
- addAction(m_mainWindow->actionCollection()->action("open_in_new_tab"));
+ addAction(m_mainWindow->actionCollection()->action(QStringLiteral("open_in_new_window")));
+ addAction(m_mainWindow->actionCollection()->action(QStringLiteral("open_in_new_tab")));
addSeparator();
}
if (selectionHasOnlyDirs) {
// insert 'Open in new tab' entry
- addAction(m_mainWindow->actionCollection()->action("open_in_new_tabs"));
+ addAction(m_mainWindow->actionCollection()->action(QStringLiteral("open_in_new_tabs")));
addSeparator();
}
}
}
// insert 'Properties...' entry
- QAction* propertiesAction = m_mainWindow->actionCollection()->action("properties");
+ QAction* propertiesAction = m_mainWindow->actionCollection()->action(QStringLiteral("properties"));
addAction(propertiesAction);
QAction* activatedAction = exec(m_pos);
// Insert 'New Window' and 'New Tab' entries. Don't use "open_in_new_window" and
// "open_in_new_tab" here, as the current selection should get ignored.
- addAction(m_mainWindow->actionCollection()->action("new_window"));
- addAction(m_mainWindow->actionCollection()->action("new_tab"));
+ addAction(m_mainWindow->actionCollection()->action(QStringLiteral("new_window")));
+ addAction(m_mainWindow->actionCollection()->action(QStringLiteral("new_tab")));
// Insert 'Add to Places' entry if exactly one item is selected
QAction* addToPlacesAction = 0;
if (!placeExists(m_mainWindow->activeViewContainer()->url())) {
- addToPlacesAction = addAction(QIcon::fromTheme("bookmark-new"),
+ addToPlacesAction = addAction(QIcon::fromTheme(QStringLiteral("bookmark-new")),
i18nc("@action:inmenu Add current folder to places", "Add to Places"));
}
addCustomActions();
- QAction* propertiesAction = m_mainWindow->actionCollection()->action("properties");
+ QAction* propertiesAction = m_mainWindow->actionCollection()->action(QStringLiteral("properties"));
addAction(propertiesAction);
addShowMenuBarAction();
addSeparator();
// Insert 'Rename'
- QAction* renameAction = collection->action("rename");
+ QAction* renameAction = collection->action(QStringLiteral("rename"));
addAction(renameAction);
// Insert 'Move to Trash' and/or 'Delete'
if (showDeleteAction && showMoveToTrashAction) {
delete m_removeAction;
m_removeAction = 0;
- addAction(m_mainWindow->actionCollection()->action("move_to_trash"));
- addAction(m_mainWindow->actionCollection()->action("delete"));
+ addAction(m_mainWindow->actionCollection()->action(QStringLiteral("move_to_trash")));
+ addAction(m_mainWindow->actionCollection()->action(QStringLiteral("delete")));
} else if (showDeleteAction && !showMoveToTrashAction) {
- addAction(m_mainWindow->actionCollection()->action("delete"));
+ addAction(m_mainWindow->actionCollection()->action(QStringLiteral("delete")));
} else {
if (!m_removeAction) {
m_removeAction = new DolphinRemoveAction(this, m_mainWindow->actionCollection());
const QMimeData *mimeData = QApplication::clipboard()->mimeData();
bool canPaste;
const QString text = KIO::pasteActionText(mimeData, &canPaste, m_fileInfo);
- action = new QAction(QIcon::fromTheme("edit-paste"), text, this);
+ action = new QAction(QIcon::fromTheme(QStringLiteral("edit-paste")), text, this);
action->setEnabled(canPaste);
connect(action, &QAction::triggered, m_mainWindow, &DolphinMainWindow::pasteIntoFolder);
} else {
fileItemActions.setParentWidget(m_mainWindow);
// insert 'Open With...' action or sub menu
- fileItemActions.addOpenWithActionsTo(this, "DesktopEntryName != 'dolphin'");
+ fileItemActions.addOpenWithActionsTo(this, QStringLiteral("DesktopEntryName != 'dolphin'"));
// insert 'Actions' sub menu
fileItemActions.addServiceActionsTo(this);
QString commonMimeType = props.mimeType();
if (commonMimeType.isEmpty()) {
- commonMimeType = QLatin1String("application/octet-stream");
+ commonMimeType = QStringLiteral("application/octet-stream");
}
- const KService::List pluginServices = KMimeTypeTrader::self()->query(commonMimeType, "KFileItemAction/Plugin", "exist Library");
+ const KService::List pluginServices = KMimeTypeTrader::self()->query(commonMimeType, QStringLiteral("KFileItemAction/Plugin"), QStringLiteral("exist Library"));
if (pluginServices.isEmpty()) {
return;
}
- const KConfig config("kservicemenurc", KConfig::NoGlobals);
+ const KConfig config(QStringLiteral("kservicemenurc"), KConfig::NoGlobals);
const KConfigGroup showGroup = config.group("Show");
foreach (const KService::Ptr& service, pluginServices) {
// Empty titlebar for the dock widgets when "Lock Layout" has been activated.
class DolphinDockTitleBar : public QWidget
{
+ Q_OBJECT
+
public:
DolphinDockTitleBar(QWidget* parent = 0) : QWidget(parent) {}
virtual ~DolphinDockTitleBar() {}
return m_locked;
}
+#include "dolphindockwidget.moc"
m_updateToolBarTimer(0),
m_lastHandleUrlStatJob(0)
{
- setObjectName("Dolphin#");
+ setObjectName(QStringLiteral("Dolphin#"));
connect(&DolphinNewFileMenuObserver::instance(), &DolphinNewFileMenuObserver::errorMessage,
this, &DolphinMainWindow::showErrorMessage);
setAcceptDrops(true);
m_tabWidget = new DolphinTabWidget(this);
- connect(m_tabWidget, SIGNAL(activeViewChanged(DolphinViewContainer*)),
- this, SLOT(activeViewChanged(DolphinViewContainer*)));
- connect(m_tabWidget, SIGNAL(tabCountChanged(int)),
- this, SLOT(tabCountChanged(int)));
- connect(m_tabWidget, SIGNAL(currentUrlChanged(QUrl)),
- this, SLOT(setUrlAsCaption(QUrl)));
+ connect(m_tabWidget, &DolphinTabWidget::activeViewChanged,
+ this, &DolphinMainWindow::activeViewChanged);
+ connect(m_tabWidget, &DolphinTabWidget::tabCountChanged,
+ this, &DolphinMainWindow::tabCountChanged);
+ connect(m_tabWidget, &DolphinTabWidget::currentUrlChanged,
+ this, &DolphinMainWindow::setUrlAsCaption);
setCentralWidget(m_tabWidget);
setupActions();
setupDockWidgets();
setupGUI(Keys | Save | Create | ToolBar);
- stateChanged("new_file");
+ stateChanged(QStringLiteral("new_file"));
QClipboard* clipboard = QApplication::clipboard();
connect(clipboard, &QClipboard::dataChanged,
this, &DolphinMainWindow::updatePasteAction);
- QAction* showFilterBarAction = actionCollection()->action("show_filter_bar");
+ QAction* showFilterBarAction = actionCollection()->action(QStringLiteral("show_filter_bar"));
showFilterBarAction->setChecked(generalSettings->filterBar());
if (firstRun) {
void DolphinMainWindow::slotEditableStateChanged(bool editable)
{
KToggleAction* editableLocationAction =
- static_cast<KToggleAction*>(actionCollection()->action("editable_location"));
+ static_cast<KToggleAction*>(actionCollection()->action(QStringLiteral("editable_location")));
editableLocationAction->setChecked(editable);
}
const int selectedUrlsCount = m_tabWidget->currentTabPage()->selectedItemsCount();
- QAction* compareFilesAction = actionCollection()->action("compare_files");
+ QAction* compareFilesAction = actionCollection()->action(QStringLiteral("compare_files"));
if (selectedUrlsCount == 2) {
compareFilesAction->setEnabled(isKompareInstalled());
} else {
const KUrlNavigator* urlNavigator = m_activeViewContainer->urlNavigator();
const int index = urlNavigator->historyIndex();
- QAction* backAction = actionCollection()->action("go_back");
+ QAction* backAction = actionCollection()->action(QStringLiteral("go_back"));
if (backAction) {
backAction->setToolTip(i18nc("@info", "Go back"));
backAction->setEnabled(index < urlNavigator->historySize() - 1);
}
- QAction* forwardAction = actionCollection()->action("go_forward");
+ QAction* forwardAction = actionCollection()->action(QStringLiteral("go_forward"));
if (forwardAction) {
forwardAction->setToolTip(i18nc("@info", "Go forward"));
forwardAction->setEnabled(index > 0);
void DolphinMainWindow::updateFilterBarAction(bool show)
{
- QAction* showFilterBarAction = actionCollection()->action("show_filter_bar");
+ QAction* showFilterBarAction = actionCollection()->action(QStringLiteral("show_filter_bar"));
showFilterBarAction->setChecked(show);
}
void DolphinMainWindow::openNewMainWindow()
{
- KRun::run("dolphin %u", QList<QUrl>(), this);
+ KRun::run(QStringLiteral("dolphin %u"), QList<QUrl>(), this);
}
void DolphinMainWindow::openNewActivatedTab()
}
if (!newWindowUrl.isEmpty()) {
- KRun::run("dolphin %u", {newWindowUrl}, this);
+ KRun::run(QStringLiteral("dolphin %u"), {newWindowUrl}, this);
}
}
dialog->setModal(true);
QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Yes | QDialogButtonBox::No | QDialogButtonBox::Cancel);
KGuiItem::assign(buttons->button(QDialogButtonBox::Yes), KStandardGuiItem::quit());
- KGuiItem::assign(buttons->button(QDialogButtonBox::No), KGuiItem(i18n("C&lose Current Tab"), QIcon::fromTheme("tab-close")));
+ KGuiItem::assign(buttons->button(QDialogButtonBox::No), KGuiItem(i18n("C&lose Current Tab"), QIcon::fromTheme(QStringLiteral("tab-close"))));
KGuiItem::assign(buttons->button(QDialogButtonBox::Cancel), KStandardGuiItem::cancel());
buttons->button(QDialogButtonBox::Yes)->setDefault(true);
void DolphinMainWindow::enableStopAction()
{
- actionCollection()->action("stop")->setEnabled(true);
+ actionCollection()->action(QStringLiteral("stop"))->setEnabled(true);
}
void DolphinMainWindow::disableStopAction()
{
- actionCollection()->action("stop")->setEnabled(false);
+ actionCollection()->action(QStringLiteral("stop"))->setEnabled(false);
}
void DolphinMainWindow::showFilterBar()
{
clearStatusBar();
- QAction* action = actionCollection()->action("editable_location");
+ QAction* action = actionCollection()->action(QStringLiteral("editable_location"));
KUrlNavigator* urlNavigator = m_activeViewContainer->urlNavigator();
urlNavigator->setUrlEditable(action->isChecked());
}
QUrl urlA = items.at(0).url();
QUrl urlB = items.at(1).url();
- QString command("kompare -c \"");
+ QString command(QStringLiteral("kompare -c \""));
command.append(urlA.toDisplayString(QUrl::PreferLocalFile));
command.append("\" \"");
command.append(urlB.toDisplayString(QUrl::PreferLocalFile));
command.append('\"');
- KRun::runCommand(command, "Kompare", "kompare", this);
+ KRun::runCommand(command, QStringLiteral("Kompare"), QStringLiteral("kompare"), this);
}
void DolphinMainWindow::toggleShowMenuBar()
case DolphinContextMenu::OpenParentFolderInNewWindow: {
- KRun::run("dolphin %u", {KIO::upUrl(item.url())}, this);
+ KRun::run(QStringLiteral("dolphin %u"), {KIO::upUrl(item.url())}, this);
break;
}
// Add "Edit" actions
bool added = addActionToMenu(ac->action(KStandardAction::name(KStandardAction::Undo)), menu) |
addActionToMenu(ac->action(KStandardAction::name(KStandardAction::Find)), menu) |
- addActionToMenu(ac->action("select_all"), menu) |
- addActionToMenu(ac->action("invert_selection"), menu);
+ addActionToMenu(ac->action(QStringLiteral("select_all")), menu) |
+ addActionToMenu(ac->action(QStringLiteral("invert_selection")), menu);
if (added) {
menu->addSeparator();
menu->addSeparator();
}
- added = addActionToMenu(ac->action("view_mode"), menu) |
- addActionToMenu(ac->action("sort"), menu) |
- addActionToMenu(ac->action("additional_info"), menu) |
- addActionToMenu(ac->action("show_preview"), menu) |
- addActionToMenu(ac->action("show_in_groups"), menu) |
- addActionToMenu(ac->action("show_hidden_files"), menu);
+ added = addActionToMenu(ac->action(QStringLiteral("view_mode")), menu) |
+ addActionToMenu(ac->action(QStringLiteral("sort")), menu) |
+ addActionToMenu(ac->action(QStringLiteral("additional_info")), menu) |
+ addActionToMenu(ac->action(QStringLiteral("show_preview")), menu) |
+ addActionToMenu(ac->action(QStringLiteral("show_in_groups")), menu) |
+ addActionToMenu(ac->action(QStringLiteral("show_hidden_files")), menu);
if (added) {
menu->addSeparator();
}
- added = addActionToMenu(ac->action("split_view"), menu) |
- addActionToMenu(ac->action("reload"), menu) |
- addActionToMenu(ac->action("view_properties"), menu);
+ added = addActionToMenu(ac->action(QStringLiteral("split_view")), menu) |
+ addActionToMenu(ac->action(QStringLiteral("reload")), menu) |
+ addActionToMenu(ac->action(QStringLiteral("view_properties")), menu);
if (added) {
menu->addSeparator();
}
- addActionToMenu(ac->action("panels"), menu);
+ addActionToMenu(ac->action(QStringLiteral("panels")), menu);
QMenu* locationBarMenu = new QMenu(i18nc("@action:inmenu", "Location Bar"), menu);
- locationBarMenu->addAction(ac->action("editable_location"));
- locationBarMenu->addAction(ac->action("replace_location"));
+ locationBarMenu->addAction(ac->action(QStringLiteral("editable_location")));
+ locationBarMenu->addAction(ac->action(QStringLiteral("replace_location")));
menu->addMenu(locationBarMenu);
menu->addSeparator();
goMenu->addAction(ac->action(KStandardAction::name(KStandardAction::Forward)));
goMenu->addAction(ac->action(KStandardAction::name(KStandardAction::Up)));
goMenu->addAction(ac->action(KStandardAction::name(KStandardAction::Home)));
- goMenu->addAction(ac->action("closed_tabs"));
+ goMenu->addAction(ac->action(QStringLiteral("closed_tabs")));
menu->addMenu(goMenu);
// Add "Tool" menu
QMenu* toolsMenu = new QMenu(i18nc("@action:inmenu", "Tools"), menu);
- toolsMenu->addAction(ac->action("show_filter_bar"));
- toolsMenu->addAction(ac->action("compare_files"));
- toolsMenu->addAction(ac->action("open_terminal"));
- toolsMenu->addAction(ac->action("change_remote_encoding"));
+ toolsMenu->addAction(ac->action(QStringLiteral("show_filter_bar")));
+ toolsMenu->addAction(ac->action(QStringLiteral("compare_files")));
+ toolsMenu->addAction(ac->action(QStringLiteral("open_terminal")));
+ toolsMenu->addAction(ac->action(QStringLiteral("change_remote_encoding")));
menu->addMenu(toolsMenu);
// Add "Settings" menu entries
void DolphinMainWindow::closedTabsCountChanged(unsigned int count)
{
- actionCollection()->action("undo_close_tab")->setEnabled(count > 0);
+ actionCollection()->action(QStringLiteral("undo_close_tab"))->setEnabled(count > 0);
}
void DolphinMainWindow::activeViewChanged(DolphinViewContainer* viewContainer)
void DolphinMainWindow::tabCountChanged(int count)
{
const bool enableTabActions = (count > 1);
- actionCollection()->action("close_tab")->setEnabled(enableTabActions);
- actionCollection()->action("activate_next_tab")->setEnabled(enableTabActions);
- actionCollection()->action("activate_prev_tab")->setEnabled(enableTabActions);
+ actionCollection()->action(QStringLiteral("close_tab"))->setEnabled(enableTabActions);
+ actionCollection()->action(QStringLiteral("activate_next_tab"))->setEnabled(enableTabActions);
+ actionCollection()->action(QStringLiteral("activate_prev_tab"))->setEnabled(enableTabActions);
}
void DolphinMainWindow::setUrlAsCaption(const QUrl& url)
m_newFileMenu = new DolphinNewFileMenu(actionCollection(), this);
QMenu* menu = m_newFileMenu->menu();
menu->setTitle(i18nc("@title:menu Create new folder, file, link, etc.", "Create New"));
- menu->setIcon(QIcon::fromTheme("document-new"));
+ menu->setIcon(QIcon::fromTheme(QStringLiteral("document-new")));
m_newFileMenu->setDelayed(false);
connect(menu, &QMenu::aboutToShow,
this, &DolphinMainWindow::updateNewMenu);
- QAction* newWindow = actionCollection()->addAction("new_window");
- newWindow->setIcon(QIcon::fromTheme("window-new"));
+ QAction* newWindow = actionCollection()->addAction(QStringLiteral("new_window"));
+ newWindow->setIcon(QIcon::fromTheme(QStringLiteral("window-new")));
newWindow->setText(i18nc("@action:inmenu File", "New &Window"));
actionCollection()->setDefaultShortcut(newWindow, Qt::CTRL | Qt::Key_N);
connect(newWindow, &QAction::triggered, this, &DolphinMainWindow::openNewMainWindow);
- QAction* newTab = actionCollection()->addAction("new_tab");
- newTab->setIcon(QIcon::fromTheme("tab-new"));
+ QAction* newTab = actionCollection()->addAction(QStringLiteral("new_tab"));
+ newTab->setIcon(QIcon::fromTheme(QStringLiteral("tab-new")));
newTab->setText(i18nc("@action:inmenu File", "New Tab"));
actionCollection()->setDefaultShortcuts(newTab, {Qt::CTRL | Qt::Key_T, Qt::CTRL | Qt::SHIFT | Qt::Key_N});
connect(newTab, &QAction::triggered, this, static_cast<void(DolphinMainWindow::*)()>(&DolphinMainWindow::openNewActivatedTab));
- QAction* closeTab = actionCollection()->addAction("close_tab");
- closeTab->setIcon(QIcon::fromTheme("tab-close"));
+ QAction* closeTab = actionCollection()->addAction(QStringLiteral("close_tab"));
+ closeTab->setIcon(QIcon::fromTheme(QStringLiteral("tab-close")));
closeTab->setText(i18nc("@action:inmenu File", "Close Tab"));
actionCollection()->setDefaultShortcut(closeTab, Qt::CTRL | Qt::Key_W);
closeTab->setEnabled(false);
KStandardAction::find(this, SLOT(find()), actionCollection());
- QAction* selectAll = actionCollection()->addAction("select_all");
+ QAction* selectAll = actionCollection()->addAction(QStringLiteral("select_all"));
selectAll->setText(i18nc("@action:inmenu Edit", "Select All"));
actionCollection()->setDefaultShortcut(selectAll, Qt::CTRL | Qt::Key_A);
connect(selectAll, &QAction::triggered, this, &DolphinMainWindow::selectAll);
- QAction* invertSelection = actionCollection()->addAction("invert_selection");
+ QAction* invertSelection = actionCollection()->addAction(QStringLiteral("invert_selection"));
invertSelection->setText(i18nc("@action:inmenu Edit", "Invert Selection"));
actionCollection()->setDefaultShortcut(invertSelection, Qt::CTRL | Qt::SHIFT | Qt::Key_A);
connect(invertSelection, &QAction::triggered, this, &DolphinMainWindow::invertSelection);
// setup 'View' menu
// (note that most of it is set up in DolphinViewActionHandler)
- QAction* split = actionCollection()->addAction("split_view");
+ QAction* split = actionCollection()->addAction(QStringLiteral("split_view"));
actionCollection()->setDefaultShortcut(split, Qt::Key_F3);
connect(split, &QAction::triggered, this, &DolphinMainWindow::toggleSplitView);
- QAction* reload = actionCollection()->addAction("reload");
+ QAction* reload = actionCollection()->addAction(QStringLiteral("reload"));
reload->setText(i18nc("@action:inmenu View", "Reload"));
actionCollection()->setDefaultShortcut(reload, Qt::Key_F5);
- reload->setIcon(QIcon::fromTheme("view-refresh"));
+ reload->setIcon(QIcon::fromTheme(QStringLiteral("view-refresh")));
connect(reload, &QAction::triggered, this, &DolphinMainWindow::reloadView);
- QAction* stop = actionCollection()->addAction("stop");
+ QAction* stop = actionCollection()->addAction(QStringLiteral("stop"));
stop->setText(i18nc("@action:inmenu View", "Stop"));
stop->setToolTip(i18nc("@info", "Stop loading"));
- stop->setIcon(QIcon::fromTheme("process-stop"));
+ stop->setIcon(QIcon::fromTheme(QStringLiteral("process-stop")));
connect(stop, &QAction::triggered, this, &DolphinMainWindow::stopLoading);
- KToggleAction* editableLocation = actionCollection()->add<KToggleAction>("editable_location");
+ KToggleAction* editableLocation = actionCollection()->add<KToggleAction>(QStringLiteral("editable_location"));
editableLocation->setText(i18nc("@action:inmenu Navigation Bar", "Editable Location"));
actionCollection()->setDefaultShortcut(editableLocation, Qt::Key_F6);
connect(editableLocation, &KToggleAction::triggered, this, &DolphinMainWindow::toggleEditLocation);
- QAction* replaceLocation = actionCollection()->addAction("replace_location");
+ QAction* replaceLocation = actionCollection()->addAction(QStringLiteral("replace_location"));
replaceLocation->setText(i18nc("@action:inmenu Navigation Bar", "Replace Location"));
actionCollection()->setDefaultShortcut(replaceLocation, Qt::CTRL | Qt::Key_L);
connect(replaceLocation, &QAction::triggered, this, &DolphinMainWindow::replaceLocation);
actionCollection()->setDefaultShortcuts(backAction, backShortcuts);
DolphinRecentTabsMenu* recentTabsMenu = new DolphinRecentTabsMenu(this);
- actionCollection()->addAction("closed_tabs", recentTabsMenu);
- connect(m_tabWidget, SIGNAL(rememberClosedTab(QUrl,QByteArray)),
- recentTabsMenu, SLOT(rememberClosedTab(QUrl,QByteArray)));
- connect(recentTabsMenu, SIGNAL(restoreClosedTab(QByteArray)),
- m_tabWidget, SLOT(restoreClosedTab(QByteArray)));
- connect(recentTabsMenu, SIGNAL(closedTabsCountChanged(uint)),
- this, SLOT(closedTabsCountChanged(uint)));
-
- QAction* undoCloseTab = actionCollection()->addAction("undo_close_tab");
+ actionCollection()->addAction(QStringLiteral("closed_tabs"), recentTabsMenu);
+ connect(m_tabWidget, &DolphinTabWidget::rememberClosedTab,
+ recentTabsMenu, &DolphinRecentTabsMenu::rememberClosedTab);
+ connect(recentTabsMenu, &DolphinRecentTabsMenu::restoreClosedTab,
+ m_tabWidget, &DolphinTabWidget::restoreClosedTab);
+ connect(recentTabsMenu, &DolphinRecentTabsMenu::closedTabsCountChanged,
+ this, &DolphinMainWindow::closedTabsCountChanged);
+
+ QAction* undoCloseTab = actionCollection()->addAction(QStringLiteral("undo_close_tab"));
undoCloseTab->setText(i18nc("@action:inmenu File", "Undo close tab"));
actionCollection()->setDefaultShortcut(undoCloseTab, Qt::CTRL | Qt::SHIFT | Qt::Key_T);
- undoCloseTab->setIcon(QIcon::fromTheme("edit-undo"));
+ undoCloseTab->setIcon(QIcon::fromTheme(QStringLiteral("edit-undo")));
undoCloseTab->setEnabled(false);
- connect(undoCloseTab, SIGNAL(triggered()), recentTabsMenu, SLOT(undoCloseTab()));
+ connect(undoCloseTab, &QAction::triggered, recentTabsMenu, &DolphinRecentTabsMenu::undoCloseTab);
auto undoAction = actionCollection()->action(KStandardAction::name(KStandardAction::Undo));
undoAction->setEnabled(false); // undo should be disabled by default
KStandardAction::home(this, SLOT(goHome()), actionCollection());
// setup 'Tools' menu
- QAction* showFilterBar = actionCollection()->addAction("show_filter_bar");
+ QAction* showFilterBar = actionCollection()->addAction(QStringLiteral("show_filter_bar"));
showFilterBar->setText(i18nc("@action:inmenu Tools", "Show Filter Bar"));
- showFilterBar->setIcon(QIcon::fromTheme("view-filter"));
+ showFilterBar->setIcon(QIcon::fromTheme(QStringLiteral("view-filter")));
actionCollection()->setDefaultShortcut(showFilterBar, Qt::CTRL | Qt::Key_I);
connect(showFilterBar, &QAction::triggered, this, &DolphinMainWindow::showFilterBar);
- QAction* compareFiles = actionCollection()->addAction("compare_files");
+ QAction* compareFiles = actionCollection()->addAction(QStringLiteral("compare_files"));
compareFiles->setText(i18nc("@action:inmenu Tools", "Compare Files"));
- compareFiles->setIcon(QIcon::fromTheme("kompare"));
+ compareFiles->setIcon(QIcon::fromTheme(QStringLiteral("kompare")));
compareFiles->setEnabled(false);
connect(compareFiles, &QAction::triggered, this, &DolphinMainWindow::compareFiles);
- QAction* openTerminal = actionCollection()->addAction("open_terminal");
+ QAction* openTerminal = actionCollection()->addAction(QStringLiteral("open_terminal"));
openTerminal->setText(i18nc("@action:inmenu Tools", "Open Terminal"));
- openTerminal->setIcon(QIcon::fromTheme("utilities-terminal"));
+ openTerminal->setIcon(QIcon::fromTheme(QStringLiteral("utilities-terminal")));
actionCollection()->setDefaultShortcut(openTerminal, Qt::SHIFT | Qt::Key_F4);
connect(openTerminal, &QAction::triggered, this, &DolphinMainWindow::openTerminal);
QList<QKeySequence> prevTabKeys = KStandardShortcut::tabPrev();
prevTabKeys.append(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_Tab));
- QAction* activateNextTab = actionCollection()->addAction("activate_next_tab");
+ QAction* activateNextTab = actionCollection()->addAction(QStringLiteral("activate_next_tab"));
activateNextTab->setIconText(i18nc("@action:inmenu", "Next Tab"));
activateNextTab->setText(i18nc("@action:inmenu", "Activate Next Tab"));
activateNextTab->setEnabled(false);
connect(activateNextTab, &QAction::triggered, m_tabWidget, &DolphinTabWidget::activateNextTab);
actionCollection()->setDefaultShortcuts(activateNextTab, QApplication::isRightToLeft() ? prevTabKeys : nextTabKeys);
- QAction* activatePrevTab = actionCollection()->addAction("activate_prev_tab");
+ QAction* activatePrevTab = actionCollection()->addAction(QStringLiteral("activate_prev_tab"));
activatePrevTab->setIconText(i18nc("@action:inmenu", "Previous Tab"));
activatePrevTab->setText(i18nc("@action:inmenu", "Activate Previous Tab"));
activatePrevTab->setEnabled(false);
actionCollection()->setDefaultShortcuts(activatePrevTab, QApplication::isRightToLeft() ? nextTabKeys : prevTabKeys);
// for context menu
- QAction* openInNewTab = actionCollection()->addAction("open_in_new_tab");
+ QAction* openInNewTab = actionCollection()->addAction(QStringLiteral("open_in_new_tab"));
openInNewTab->setText(i18nc("@action:inmenu", "Open in New Tab"));
- openInNewTab->setIcon(QIcon::fromTheme("tab-new"));
+ openInNewTab->setIcon(QIcon::fromTheme(QStringLiteral("tab-new")));
connect(openInNewTab, &QAction::triggered, this, &DolphinMainWindow::openInNewTab);
- QAction* openInNewTabs = actionCollection()->addAction("open_in_new_tabs");
+ QAction* openInNewTabs = actionCollection()->addAction(QStringLiteral("open_in_new_tabs"));
openInNewTabs->setText(i18nc("@action:inmenu", "Open in New Tabs"));
- openInNewTabs->setIcon(QIcon::fromTheme("tab-new"));
+ openInNewTabs->setIcon(QIcon::fromTheme(QStringLiteral("tab-new")));
connect(openInNewTabs, &QAction::triggered, this, &DolphinMainWindow::openInNewTab);
- QAction* openInNewWindow = actionCollection()->addAction("open_in_new_window");
+ QAction* openInNewWindow = actionCollection()->addAction(QStringLiteral("open_in_new_window"));
openInNewWindow->setText(i18nc("@action:inmenu", "Open in New Window"));
- openInNewWindow->setIcon(QIcon::fromTheme("window-new"));
+ openInNewWindow->setIcon(QIcon::fromTheme(QStringLiteral("window-new")));
connect(openInNewWindow, &QAction::triggered, this, &DolphinMainWindow::openInNewWindow);
}
{
const bool lock = GeneralSettings::lockPanels();
- KDualAction* lockLayoutAction = actionCollection()->add<KDualAction>("lock_panels");
+ KDualAction* lockLayoutAction = actionCollection()->add<KDualAction>(QStringLiteral("lock_panels"));
lockLayoutAction->setActiveText(i18nc("@action:inmenu Panels", "Unlock Panels"));
- lockLayoutAction->setActiveIcon(QIcon::fromTheme("object-unlocked"));
+ lockLayoutAction->setActiveIcon(QIcon::fromTheme(QStringLiteral("object-unlocked")));
lockLayoutAction->setInactiveText(i18nc("@action:inmenu Panels", "Lock Panels"));
- lockLayoutAction->setInactiveIcon(QIcon::fromTheme("object-locked"));
+ lockLayoutAction->setInactiveIcon(QIcon::fromTheme(QStringLiteral("object-locked")));
lockLayoutAction->setActive(lock);
connect(lockLayoutAction, &KDualAction::triggered, this, &DolphinMainWindow::togglePanelLockState);
// Setup "Information"
DolphinDockWidget* infoDock = new DolphinDockWidget(i18nc("@title:window", "Information"));
infoDock->setLocked(lock);
- infoDock->setObjectName("infoDock");
+ infoDock->setObjectName(QStringLiteral("infoDock"));
infoDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
InformationPanel* infoPanel = new InformationPanel(infoDock);
infoPanel->setCustomContextMenuActions({lockLayoutAction});
infoDock->setWidget(infoPanel);
QAction* infoAction = infoDock->toggleViewAction();
- createPanelAction(QIcon::fromTheme("dialog-information"), Qt::Key_F11, infoAction, "show_information_panel");
+ createPanelAction(QIcon::fromTheme(QStringLiteral("dialog-information")), Qt::Key_F11, infoAction, QStringLiteral("show_information_panel"));
addDockWidget(Qt::RightDockWidgetArea, infoDock);
connect(this, &DolphinMainWindow::urlChanged,
// Setup "Folders"
DolphinDockWidget* foldersDock = new DolphinDockWidget(i18nc("@title:window", "Folders"));
foldersDock->setLocked(lock);
- foldersDock->setObjectName("foldersDock");
+ foldersDock->setObjectName(QStringLiteral("foldersDock"));
foldersDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
FoldersPanel* foldersPanel = new FoldersPanel(foldersDock);
foldersPanel->setCustomContextMenuActions({lockLayoutAction});
foldersDock->setWidget(foldersPanel);
QAction* foldersAction = foldersDock->toggleViewAction();
- createPanelAction(QIcon::fromTheme("folder"), Qt::Key_F7, foldersAction, "show_folders_panel");
+ createPanelAction(QIcon::fromTheme(QStringLiteral("folder")), Qt::Key_F7, foldersAction, QStringLiteral("show_folders_panel"));
addDockWidget(Qt::LeftDockWidgetArea, foldersDock);
connect(this, &DolphinMainWindow::urlChanged,
#ifndef Q_OS_WIN
DolphinDockWidget* terminalDock = new DolphinDockWidget(i18nc("@title:window Shell terminal", "Terminal"));
terminalDock->setLocked(lock);
- terminalDock->setObjectName("terminalDock");
+ terminalDock->setObjectName(QStringLiteral("terminalDock"));
terminalDock->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
TerminalPanel* terminalPanel = new TerminalPanel(terminalDock);
terminalPanel->setCustomContextMenuActions({lockLayoutAction});
terminalPanel, &TerminalPanel::dockVisibilityChanged);
QAction* terminalAction = terminalDock->toggleViewAction();
- createPanelAction(QIcon::fromTheme("utilities-terminal"), Qt::Key_F4, terminalAction, "show_terminal_panel");
+ createPanelAction(QIcon::fromTheme(QStringLiteral("utilities-terminal")), Qt::Key_F4, terminalAction, QStringLiteral("show_terminal_panel"));
addDockWidget(Qt::BottomDockWidgetArea, terminalDock);
connect(this, &DolphinMainWindow::urlChanged,
// Setup "Places"
DolphinDockWidget* placesDock = new DolphinDockWidget(i18nc("@title:window", "Places"));
placesDock->setLocked(lock);
- placesDock->setObjectName("placesDock");
+ placesDock->setObjectName(QStringLiteral("placesDock"));
placesDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
PlacesPanel* placesPanel = new PlacesPanel(placesDock);
placesDock->setWidget(placesPanel);
QAction* placesAction = placesDock->toggleViewAction();
- createPanelAction(QIcon::fromTheme("bookmarks"), Qt::Key_F9, placesAction, "show_places_panel");
+ createPanelAction(QIcon::fromTheme(QStringLiteral("bookmarks")), Qt::Key_F9, placesAction, QStringLiteral("show_places_panel"));
addDockWidget(Qt::LeftDockWidgetArea, placesDock);
connect(placesPanel, &PlacesPanel::placeActivated,
this, &DolphinMainWindow::slotPlaceActivated);
- connect(placesPanel, SIGNAL(placeMiddleClicked(QUrl)),
- this, SLOT(openNewTab(QUrl)));
+ connect(placesPanel, &PlacesPanel::placeMiddleClicked,
+ this, &DolphinMainWindow::openNewTab);
connect(placesPanel, &PlacesPanel::errorMessage,
this, &DolphinMainWindow::showErrorMessage);
connect(this, &DolphinMainWindow::urlChanged,
// Add actions into the "Panels" menu
KActionMenu* panelsMenu = new KActionMenu(i18nc("@action:inmenu View", "Panels"), this);
- actionCollection()->addAction("panels", panelsMenu);
+ actionCollection()->addAction(QStringLiteral("panels"), panelsMenu);
panelsMenu->setDelayed(false);
const KActionCollection* ac = actionCollection();
- panelsMenu->addAction(ac->action("show_places_panel"));
- panelsMenu->addAction(ac->action("show_information_panel"));
- panelsMenu->addAction(ac->action("show_folders_panel"));
+ panelsMenu->addAction(ac->action(QStringLiteral("show_places_panel")));
+ panelsMenu->addAction(ac->action(QStringLiteral("show_information_panel")));
+ panelsMenu->addAction(ac->action(QStringLiteral("show_folders_panel")));
#ifndef Q_OS_WIN
- panelsMenu->addAction(ac->action("show_terminal_panel"));
+ panelsMenu->addAction(ac->action(QStringLiteral("show_terminal_panel")));
#endif
panelsMenu->addSeparator();
panelsMenu->addAction(lockLayoutAction);
{
const KFileItemList list = m_activeViewContainer->view()->selectedItems();
if (list.isEmpty()) {
- stateChanged("has_no_selection");
+ stateChanged(QStringLiteral("has_no_selection"));
} else {
- stateChanged("has_selection");
+ stateChanged(QStringLiteral("has_selection"));
KActionCollection* col = actionCollection();
- QAction* renameAction = col->action("rename");
- QAction* moveToTrashAction = col->action("move_to_trash");
- QAction* deleteAction = col->action("delete");
+ QAction* renameAction = col->action(QStringLiteral("rename"));
+ QAction* moveToTrashAction = col->action(QStringLiteral("move_to_trash"));
+ QAction* deleteAction = col->action(QStringLiteral("delete"));
QAction* cutAction = col->action(KStandardAction::name(KStandardAction::Cut));
- QAction* deleteWithTrashShortcut = col->action("delete_shortcut"); // see DolphinViewActionHandler
+ QAction* deleteWithTrashShortcut = col->action(QStringLiteral("delete_shortcut")); // see DolphinViewActionHandler
KFileItemListProperties capabilities(list);
const bool enableMoveToTrash = capabilities.isLocal() && capabilities.supportsMoving();
{
m_actionHandler->updateViewActions();
- QAction* showFilterBarAction = actionCollection()->action("show_filter_bar");
+ QAction* showFilterBarAction = actionCollection()->action(QStringLiteral("show_filter_bar"));
showFilterBarAction->setChecked(m_activeViewContainer->isFilterBarVisible());
updateSplitAction();
- QAction* editableLocactionAction = actionCollection()->action("editable_location");
+ QAction* editableLocactionAction = actionCollection()->action(QStringLiteral("editable_location"));
const KUrlNavigator* urlNavigator = m_activeViewContainer->urlNavigator();
editableLocactionAction->setChecked(urlNavigator->isUrlEditable());
}
Q_ASSERT(!m_controlButton);
m_controlButton = new QToolButton(this);
- m_controlButton->setIcon(QIcon::fromTheme("application-menu"));
+ m_controlButton->setIcon(QIcon::fromTheme(QStringLiteral("application-menu")));
m_controlButton->setText(i18nc("@action", "Control"));
m_controlButton->setPopupMode(QToolButton::InstantPopup);
m_controlButton->setToolButtonStyle(toolBar()->toolButtonStyle());
void DolphinMainWindow::updateSplitAction()
{
- QAction* splitAction = actionCollection()->action("split_view");
+ QAction* splitAction = actionCollection()->action(QStringLiteral("split_view"));
const DolphinTabPage* tabPage = m_tabWidget->currentTabPage();
if (tabPage->splitViewEnabled()) {
if (tabPage->primaryViewActive()) {
splitAction->setText(i18nc("@action:intoolbar Close left view", "Close"));
splitAction->setToolTip(i18nc("@info", "Close left view"));
- splitAction->setIcon(QIcon::fromTheme("view-left-close"));
+ splitAction->setIcon(QIcon::fromTheme(QStringLiteral("view-left-close")));
} else {
splitAction->setText(i18nc("@action:intoolbar Close right view", "Close"));
splitAction->setToolTip(i18nc("@info", "Close right view"));
- splitAction->setIcon(QIcon::fromTheme("view-right-close"));
+ splitAction->setIcon(QIcon::fromTheme(QStringLiteral("view-right-close")));
}
} else {
splitAction->setText(i18nc("@action:intoolbar Split view", "Split"));
splitAction->setToolTip(i18nc("@info", "Split view"));
- splitAction->setIcon(QIcon::fromTheme("view-right-new"));
+ splitAction->setIcon(QIcon::fromTheme(QStringLiteral("view-right-new")));
}
}
#include <KIO/Job>
DolphinNewFileMenu::DolphinNewFileMenu(KActionCollection* collection, QObject* parent) :
- KNewFileMenu(collection, "new_menu", parent)
+ KNewFileMenu(collection, QStringLiteral("new_menu"), parent)
{
DolphinNewFileMenuObserver::instance().attach(this);
}
m_extension = new DolphinPartBrowserExtension(this);
// make sure that other apps using this part find Dolphin's view-file-columns icons
- KIconLoader::global()->addAppDir("dolphin");
+ KIconLoader::global()->addAppDir(QStringLiteral("dolphin"));
m_view = new DolphinView(QUrl(), parentWidget);
m_view->setTabsForFilesEnabled(true);
connect(m_view, &DolphinView::directoryLoadingProgress, this, &DolphinPart::updateProgress);
connect(m_view, &DolphinView::errorMessage, this, &DolphinPart::slotErrorMessage);
- setXMLFile("dolphinpart.rc");
+ setXMLFile(QStringLiteral("dolphinpart.rc"));
connect(m_view, &DolphinView::infoMessage,
this, &DolphinPart::slotMessage);
connect(m_newFileMenu->menu(), &QMenu::aboutToShow,
this, &DolphinPart::updateNewMenu);
- QAction *editMimeTypeAction = actionCollection()->addAction( "editMimeType" );
+ QAction *editMimeTypeAction = actionCollection()->addAction( QStringLiteral("editMimeType") );
editMimeTypeAction->setText( i18nc("@action:inmenu Edit", "&Edit File Type..." ) );
connect(editMimeTypeAction, &QAction::triggered, this, &DolphinPart::slotEditMimeType);
- QAction* selectItemsMatching = actionCollection()->addAction("select_items_matching");
+ QAction* selectItemsMatching = actionCollection()->addAction(QStringLiteral("select_items_matching"));
selectItemsMatching->setText(i18nc("@action:inmenu Edit", "Select Items Matching..."));
actionCollection()->setDefaultShortcut(selectItemsMatching, Qt::CTRL | Qt::Key_S);
connect(selectItemsMatching, &QAction::triggered, this, &DolphinPart::slotSelectItemsMatchingPattern);
- QAction* unselectItemsMatching = actionCollection()->addAction("unselect_items_matching");
+ QAction* unselectItemsMatching = actionCollection()->addAction(QStringLiteral("unselect_items_matching"));
unselectItemsMatching->setText(i18nc("@action:inmenu Edit", "Unselect Items Matching..."));
connect(unselectItemsMatching, &QAction::triggered, this, &DolphinPart::slotUnselectItemsMatchingPattern);
- actionCollection()->addAction(KStandardAction::SelectAll, "select_all", m_view, SLOT(selectAll()));
+ actionCollection()->addAction(KStandardAction::SelectAll, QStringLiteral("select_all"), m_view, SLOT(selectAll()));
- QAction* unselectAll = actionCollection()->addAction("unselect_all");
+ QAction* unselectAll = actionCollection()->addAction(QStringLiteral("unselect_all"));
unselectAll->setText(i18nc("@action:inmenu Edit", "Unselect All"));
connect(unselectAll, &QAction::triggered, m_view, &DolphinView::clearSelection);
- QAction* invertSelection = actionCollection()->addAction("invert_selection");
+ QAction* invertSelection = actionCollection()->addAction(QStringLiteral("invert_selection"));
invertSelection->setText(i18nc("@action:inmenu Edit", "Invert Selection"));
actionCollection()->setDefaultShortcut(invertSelection, Qt::CTRL | Qt::SHIFT | Qt::Key_A);
connect(invertSelection, &QAction::triggered, m_view, &DolphinView::invertSelection);
goActionGroup);
// Tools menu
- m_findFileAction = actionCollection()->addAction("find_file");
+ m_findFileAction = actionCollection()->addAction(QStringLiteral("find_file"));
m_findFileAction->setText(i18nc("@action:inmenu Tools", "Find File..."));
actionCollection()->setDefaultShortcut(m_findFileAction, Qt::CTRL | Qt::Key_F);
- m_findFileAction->setIcon(QIcon::fromTheme("edit-find"));
+ m_findFileAction->setIcon(QIcon::fromTheme(QStringLiteral("edit-find")));
connect(m_findFileAction, &QAction::triggered, this, &DolphinPart::slotFindFile);
- if (KAuthorized::authorizeKAction("shell_access")) {
- m_openTerminalAction = actionCollection()->addAction("open_terminal");
- m_openTerminalAction->setIcon(QIcon::fromTheme("utilities-terminal"));
+ if (KAuthorized::authorizeKAction(QStringLiteral("shell_access"))) {
+ m_openTerminalAction = actionCollection()->addAction(QStringLiteral("open_terminal"));
+ m_openTerminalAction->setIcon(QIcon::fromTheme(QStringLiteral("utilities-terminal")));
m_openTerminalAction->setText(i18nc("@action:inmenu Tools", "Open &Terminal"));
connect(m_openTerminalAction, &QAction::triggered, this, &DolphinPart::slotOpenTerminal);
actionCollection()->setDefaultShortcut(m_openTerminalAction, Qt::Key_F4);
{
const bool hasSelection = !selection.isEmpty();
- QAction* renameAction = actionCollection()->action("rename");
- QAction* moveToTrashAction = actionCollection()->action("move_to_trash");
- QAction* deleteAction = actionCollection()->action("delete");
- QAction* editMimeTypeAction = actionCollection()->action("editMimeType");
- QAction* propertiesAction = actionCollection()->action("properties");
- QAction* deleteWithTrashShortcut = actionCollection()->action("delete_shortcut"); // see DolphinViewActionHandler
+ QAction* renameAction = actionCollection()->action(QStringLiteral("rename"));
+ QAction* moveToTrashAction = actionCollection()->action(QStringLiteral("move_to_trash"));
+ QAction* deleteAction = actionCollection()->action(QStringLiteral("delete"));
+ QAction* editMimeTypeAction = actionCollection()->action(QStringLiteral("editMimeType"));
+ QAction* propertiesAction = actionCollection()->action(QStringLiteral("properties"));
+ QAction* deleteWithTrashShortcut = actionCollection()->action(QStringLiteral("delete_shortcut")); // see DolphinViewActionHandler
if (!hasSelection) {
- stateChanged("has_no_selection");
+ stateChanged(QStringLiteral("has_no_selection"));
emit m_extension->enableAction("cut", false);
emit m_extension->enableAction("copy", false);
deleteWithTrashShortcut->setEnabled(false);
editMimeTypeAction->setEnabled(false);
} else {
- stateChanged("has_selection");
+ stateChanged(QStringLiteral("has_selection"));
// TODO share this code with DolphinMainWindow::updateEditActions (and the desktop code)
// in libkonq
KAboutData* DolphinPart::createAboutData()
{
- return new KAboutData("dolphinpart", i18nc("@title", "Dolphin Part"), "0.1");
+ return new KAboutData(QStringLiteral("dolphinpart"), i18nc("@title", "Dolphin Part"), QStringLiteral("0.1"));
}
bool DolphinPart::openUrl(const QUrl &url)
updateStatusBar();
} else {
const QString escapedText = Qt::convertFromPlainText(item.getStatusBarInfo());
- ReadOnlyPart::setStatusBarText(QString("<qt>%1</qt>").arg(escapedText));
+ ReadOnlyPart::setStatusBarText(QStringLiteral("<qt>%1</qt>").arg(escapedText));
}
}
if (showDeleteAction && showMoveToTrashAction) {
delete m_removeAction;
m_removeAction = 0;
- editActions.append(actionCollection()->action("move_to_trash"));
- editActions.append(actionCollection()->action("delete"));
+ editActions.append(actionCollection()->action(QStringLiteral("move_to_trash")));
+ editActions.append(actionCollection()->action(QStringLiteral("delete")));
} else if (showDeleteAction && !showMoveToTrashAction) {
- editActions.append(actionCollection()->action("delete"));
+ editActions.append(actionCollection()->action(QStringLiteral("delete")));
} else {
if (!m_removeAction)
m_removeAction = new DolphinRemoveAction(this, actionCollection());
}
if (supportsMoving) {
- editActions.append(actionCollection()->action("rename"));
+ editActions.append(actionCollection()->action(QStringLiteral("rename")));
}
// Normally KonqPopupMenu only shows the "Create new" submenu in the current view
}
- actionGroups.insert("editactions", editActions);
+ actionGroups.insert(QStringLiteral("editactions"), editActions);
emit m_extension->popupMenu(pos,
items,
void DolphinPart::openSelectionDialog(const QString& title, const QString& text, bool selectItems)
{
bool okClicked;
- const QString pattern = QInputDialog::getText(m_view, title, text, QLineEdit::Normal, "*", &okClicked);
+ const QString pattern = QInputDialog::getText(m_view, title, text, QLineEdit::Normal, QStringLiteral("*"), &okClicked);
if (okClicked && !pattern.isEmpty()) {
QRegExp patternRegExp(pattern, Qt::CaseSensitive, QRegExp::Wildcard);
void DolphinPart::slotFindFile()
{
- KRun::run("kfind", {url()}, widget());
+ KRun::run(QStringLiteral("kfind"), {url()}, widget());
}
void DolphinPart::updateNewMenu()
void DolphinPart::updateStatusBar()
{
const QString escapedText = Qt::convertFromPlainText(m_view->statusBarText());
- emit ReadOnlyPart::setStatusBarText(QString("<qt>%1</qt>").arg(escapedText));
+ emit ReadOnlyPart::setStatusBarText(QStringLiteral("<qt>%1</qt>").arg(escapedText));
}
void DolphinPart::updateProgress(int percent)
/**
* We reimplement openUrl so no need to implement openFile.
*/
- virtual bool openFile() { return true; }
+ virtual bool openFile() override { return true; }
Q_SIGNALS:
/**
#include <QMenu>
DolphinRecentTabsMenu::DolphinRecentTabsMenu(QObject* parent) :
- KActionMenu(QIcon::fromTheme("edit-undo"), i18n("Recently Closed Tabs"), parent)
+ KActionMenu(QIcon::fromTheme(QStringLiteral("edit-undo")), i18n("Recently Closed Tabs"), parent)
{
setDelayed(false);
setEnabled(false);
m_clearListAction = new QAction(i18n("Empty Recently Closed Tabs"), this);
- m_clearListAction->setIcon(QIcon::fromTheme("edit-clear-list"));
+ m_clearListAction->setIcon(QIcon::fromTheme(QStringLiteral("edit-clear-list")));
addAction(m_clearListAction);
addSeparator();
- connect(menu(), SIGNAL(triggered(QAction*)),
- this, SLOT(handleAction(QAction*)));
+ connect(menu(), &QMenu::triggered,
+ this, &DolphinRecentTabsMenu::handleAction);
}
void DolphinRecentTabsMenu::rememberClosedTab(const QUrl& url, const QByteArray& state)
}
emit closedTabsCountChanged(0);
} else {
- const QByteArray state = action->data().value<QByteArray>();
+ const QByteArray state = action->data().toByteArray();
removeAction(action);
delete action;
action = 0;
// This is only done until the original action has been shown at least once. To
// bypass this issue, the text and &-shortcut is applied manually.
if (qApp->keyboardModifiers() & Qt::ShiftModifier) {
- m_action = m_collection ? m_collection->action("delete") : 0;
+ m_action = m_collection ? m_collection->action(QStringLiteral("delete")) : 0;
setText(i18nc("@action:inmenu", "&Delete"));
} else {
- m_action = m_collection ? m_collection->action("move_to_trash") : 0;
+ m_action = m_collection ? m_collection->action(QStringLiteral("move_to_trash")) : 0;
setText(i18nc("@action:inmenu", "&Move to Trash"));
}
m_autoActivationTimer = new QTimer(this);
m_autoActivationTimer->setSingleShot(true);
m_autoActivationTimer->setInterval(800);
- connect(m_autoActivationTimer, SIGNAL(timeout()),
- this, SLOT(slotAutoActivationTimeout()));
+ connect(m_autoActivationTimer, &QTimer::timeout,
+ this, &DolphinTabBar::slotAutoActivationTimeout);
}
void DolphinTabBar::dragEnterEvent(QDragEnterEvent* event)
// Tab context menu
QMenu menu(this);
- QAction* newTabAction = menu.addAction(QIcon::fromTheme("tab-new"), i18nc("@action:inmenu", "New Tab"));
- QAction* detachTabAction = menu.addAction(QIcon::fromTheme("tab-detach"), i18nc("@action:inmenu", "Detach Tab"));
- QAction* closeOtherTabsAction = menu.addAction(QIcon::fromTheme("tab-close-other"), i18nc("@action:inmenu", "Close Other Tabs"));
- QAction* closeTabAction = menu.addAction(QIcon::fromTheme("tab-close"), i18nc("@action:inmenu", "Close Tab"));
+ QAction* newTabAction = menu.addAction(QIcon::fromTheme(QStringLiteral("tab-new")), i18nc("@action:inmenu", "New Tab"));
+ QAction* detachTabAction = menu.addAction(QIcon::fromTheme(QStringLiteral("tab-detach")), i18nc("@action:inmenu", "Detach Tab"));
+ QAction* closeOtherTabsAction = menu.addAction(QIcon::fromTheme(QStringLiteral("tab-close-other")), i18nc("@action:inmenu", "Close Other Tabs"));
+ QAction* closeTabAction = menu.addAction(QIcon::fromTheme(QStringLiteral("tab-close")), i18nc("@action:inmenu", "Close Tab"));
QAction* selectedAction = menu.exec(event->globalPos());
if (selectedAction == newTabAction) {
// Create a new primary view
m_primaryViewContainer = createViewContainer(primaryUrl);
- connect(m_primaryViewContainer->view(), SIGNAL(urlChanged(QUrl)),
- this, SIGNAL(activeViewUrlChanged(QUrl)));
- connect(m_primaryViewContainer->view(), SIGNAL(redirection(QUrl,QUrl)),
- this, SLOT(slotViewUrlRedirection(QUrl,QUrl)));
+ connect(m_primaryViewContainer->view(), &DolphinView::urlChanged,
+ this, &DolphinTabPage::activeViewUrlChanged);
+ connect(m_primaryViewContainer->view(), &DolphinView::redirection,
+ this, &DolphinTabPage::slotViewUrlRedirection);
m_splitter->addWidget(m_primaryViewContainer);
m_primaryViewContainer->show();
const DolphinView* newActiveView = activeViewContainer()->view();
if (newActiveView != oldActiveView) {
- disconnect(oldActiveView, SIGNAL(urlChanged(QUrl)),
- this, SIGNAL(activeViewUrlChanged(QUrl)));
- disconnect(oldActiveView, SIGNAL(redirection(QUrl,QUrl)),
- this, SLOT(slotViewUrlRedirection(QUrl,QUrl)));
- connect(newActiveView, SIGNAL(urlChanged(QUrl)),
- this, SIGNAL(activeViewUrlChanged(QUrl)));
- connect(newActiveView, SIGNAL(redirection(QUrl,QUrl)),
- this, SLOT(slotViewUrlRedirection(QUrl,QUrl)));
+ disconnect(oldActiveView, &DolphinView::urlChanged,
+ this, &DolphinTabPage::activeViewUrlChanged);
+ disconnect(oldActiveView, &DolphinView::redirection,
+ this, &DolphinTabPage::slotViewUrlRedirection);
+ connect(newActiveView, &DolphinView::urlChanged,
+ this, &DolphinTabPage::activeViewUrlChanged);
+ connect(newActiveView, &DolphinView::redirection,
+ this, &DolphinTabPage::slotViewUrlRedirection);
}
emit activeViewUrlChanged(activeViewContainer()->url());
container->setActive(false);
const DolphinView* view = container->view();
- connect(view, SIGNAL(activated()),
- this, SLOT(slotViewActivated()));
+ connect(view, &DolphinView::activated,
+ this, &DolphinTabPage::slotViewActivated);
return container;
}
#include "dolphinviewcontainer.h"
#include <QApplication>
+#include <QDropEvent>
#include <KConfigGroup>
#include <KShell>
#include <kio/global.h>
QTabWidget(parent),
m_placesSelectorVisible(true)
{
- connect(this, SIGNAL(tabCloseRequested(int)),
- this, SLOT(closeTab(int)));
- connect(this, SIGNAL(currentChanged(int)),
- this, SLOT(currentTabChanged(int)));
+ connect(this, &DolphinTabWidget::tabCloseRequested,
+ this, static_cast<void (DolphinTabWidget::*)(int)>(&DolphinTabWidget::closeTab));
+ connect(this, &DolphinTabWidget::currentChanged,
+ this, &DolphinTabWidget::currentTabChanged);
DolphinTabBar* tabBar = new DolphinTabBar(this);
- connect(tabBar, SIGNAL(openNewActivatedTab(int)),
- this, SLOT(openNewActivatedTab(int)));
- connect(tabBar, SIGNAL(tabDropEvent(int,QDropEvent*)),
- this, SLOT(tabDropEvent(int,QDropEvent*)));
- connect(tabBar, SIGNAL(tabDetachRequested(int)),
- this, SLOT(detachTab(int)));
+ connect(tabBar, &DolphinTabBar::openNewActivatedTab,
+ this, static_cast<void (DolphinTabWidget::*)(int)>(&DolphinTabWidget::openNewActivatedTab));
+ connect(tabBar, &DolphinTabBar::tabDropEvent,
+ this, &DolphinTabWidget::tabDropEvent);
+ connect(tabBar, &DolphinTabBar::tabDetachRequested,
+ this, &DolphinTabWidget::detachTab);
tabBar->hide();
setTabBar(tabBar);
DolphinTabPage* tabPage = new DolphinTabPage(primaryUrl, secondaryUrl, this);
tabPage->setPlacesSelectorVisible(m_placesSelectorVisible);
- connect(tabPage, SIGNAL(activeViewChanged(DolphinViewContainer*)),
- this, SIGNAL(activeViewChanged(DolphinViewContainer*)));
- connect(tabPage, SIGNAL(activeViewUrlChanged(QUrl)),
- this, SLOT(tabUrlChanged(QUrl)));
+ connect(tabPage, &DolphinTabPage::activeViewChanged,
+ this, &DolphinTabWidget::activeViewChanged);
+ connect(tabPage, &DolphinTabPage::activeViewUrlChanged,
+ this, &DolphinTabWidget::tabUrlChanged);
addTab(tabPage, QIcon::fromTheme(KIO::iconNameForUrl(primaryUrl)), tabName(primaryUrl));
if (focusWidget) {
QString DolphinTabWidget::tabName(const QUrl& url) const
{
QString name;
- if (url == QUrl("file:///")) {
+ if (url == QUrl(QStringLiteral("file:///"))) {
name = '/';
} else {
name = url.adjusted(QUrl::StripTrailingSlash).fileName();
} else {
// Make sure that a '&' inside the directory name is displayed correctly
// and not misinterpreted as a keyboard shortcut in QTabBar::setTabText()
- name.replace('&', "&&");
+ name.replace('&', QLatin1String("&&"));
}
}
return name;
// When an URL has been entered, the view should get the focus.
// The focus must be requested asynchronously, as changing the URL might create
// a new view widget.
- QTimer::singleShot(0, this, SLOT(requestFocus()));
+ QTimer::singleShot(0, this, &DolphinViewContainer::requestFocus);
}
} else if (KProtocolManager::isSourceProtocol(url)) {
- QString app = "konqueror";
+ QString app = QStringLiteral("konqueror");
if (url.scheme().startsWith(QLatin1String("http"))) {
showMessage(i18nc("@info:status", // krazy:exclude=qmethods
"Dolphin does not support web pages, the web browser has been launched"),
Information);
- const KConfigGroup config(KSharedConfig::openConfig("kdeglobals"), "General");
+ const KConfigGroup config(KSharedConfig::openConfig(QStringLiteral("kdeglobals")), "General");
const QString browser = config.readEntry("BrowserApplication");
if (!browser.isEmpty()) {
app = browser;
{
const QUrl url = m_searchBox->urlForSearching();
if (url.isValid() && !url.isEmpty()) {
- m_view->setViewPropertiesContext("search");
+ m_view->setViewPropertiesContext(QStringLiteral("search"));
m_urlNavigator->setLocationUrl(url);
}
}
bool DolphinViewContainer::isSearchUrl(const QUrl& url) const
{
- return url.scheme().contains("search");
+ return url.scheme().contains(QStringLiteral("search"));
}
void DolphinViewContainer::saveViewState()
// Create close button
QToolButton *closeButton = new QToolButton(this);
closeButton->setAutoRaise(true);
- closeButton->setIcon(QIcon::fromTheme("dialog-close"));
+ closeButton->setIcon(QIcon::fromTheme(QStringLiteral("dialog-close")));
closeButton->setToolTip(i18nc("@info:tooltip", "Hide Filter Bar"));
connect(closeButton, &QToolButton::clicked, this, &FilterBar::closeRequest);
m_lockButton = new QToolButton(this);
m_lockButton->setAutoRaise(true);
m_lockButton->setCheckable(true);
- m_lockButton->setIcon(QIcon::fromTheme("object-unlocked"));
+ m_lockButton->setIcon(QIcon::fromTheme(QStringLiteral("object-unlocked")));
m_lockButton->setToolTip(i18nc("@info:tooltip", "Keep Filter When Changing Folders"));
connect(m_lockButton, &QToolButton::toggled, this, &FilterBar::slotToggleLockButton);
void FilterBar::slotToggleLockButton(bool checked)
{
if (checked) {
- m_lockButton->setIcon(QIcon::fromTheme("object-locked"));
+ m_lockButton->setIcon(QIcon::fromTheme(QStringLiteral("object-locked")));
} else {
- m_lockButton->setIcon(QIcon::fromTheme("object-unlocked"));
+ m_lockButton->setIcon(QIcon::fromTheme(QStringLiteral("object-unlocked")));
clear();
}
}
int x = 0;
int y = 0;
- foreach (int index, indexes) {
+ for (int index : indexes) {
QPixmap pixmap = model()->data(index).value("iconPixmap").value<QPixmap>();
if (pixmap.isNull()) {
QIcon icon = QIcon::fromTheme(model()->data(index).value("iconName").toString());
KFileItemModel::~KFileItemModel()
{
qDeleteAll(m_itemData);
- qDeleteAll(m_filteredItems.values());
+ qDeleteAll(m_filteredItems);
qDeleteAll(m_pendingItemsToInsert);
}
bool canUseMostLocalUrls = true;
const ItemData* lastAddedItem = 0;
- foreach (int index, indexes) {
+ for (int index : indexes) {
const ItemData* itemData = m_itemData.at(index);
const ItemData* parent = itemData->parent;
qCDebug(DolphinDebug) << "Clearing all items";
#endif
- qDeleteAll(m_filteredItems.values());
+ qDeleteAll(m_filteredItems);
m_filteredItems.clear();
m_groups.clear();
if (m_requestRole[DestinationRole]) {
QString destination = item.linkDest();
if (destination.isEmpty()) {
- destination = QLatin1String("-");
+ destination = QStringLiteral("-");
}
data.insert(sharedValue("destination"), destination);
}
m_collator.setNumericMode(other.m_collator.numericMode());
}
+ ~KFileItemModelLessThan() = default;
+ //We do not delete m_model as the pointer was passed from outside ant it will be deleted elsewhere.
+
+ KFileItemModelLessThan& operator=(const KFileItemModelLessThan& other)
+ {
+ m_model = other.m_model;
+ m_collator = other.m_collator;
+ return *this;
+ }
+
bool operator()(const KFileItemModel::ItemData* a, const KFileItemModel::ItemData* b) const
{
return m_model->lessThan(a, b, m_collator);
if (newFirstChar.isLetter()) {
// Try to find a matching group in the range 'A' to 'Z'.
static std::vector<QChar> lettersAtoZ;
+ lettersAtoZ.reserve('Z' - 'A' + 1);
if (lettersAtoZ.empty()) {
for (char c = 'A'; c <= 'Z'; ++c) {
lettersAtoZ.push_back(QLatin1Char(c));
}
}
- auto localeAwareLessThan = [this](const QChar& c1, const QChar& c2) -> bool {
+ auto localeAwareLessThan = [this](QChar c1, QChar c2) -> bool {
return m_collator.compare(c1, c2) < 0;
};
const KConfigGroup globalConfig(KSharedConfig::openConfig(), "PreviewSettings");
m_enabledPlugins = globalConfig.readEntry("Plugins", QStringList()
- << "directorythumbnail"
- << "imagethumbnail"
- << "jpegthumbnail");
+ << QStringLiteral("directorythumbnail")
+ << QStringLiteral("imagethumbnail")
+ << QStringLiteral("jpegthumbnail"));
connect(m_model, &KFileItemModel::itemsInserted,
this, &KFileItemModelRolesUpdater::slotItemsInserted);
if (!m_pendingSortRoleItems.isEmpty()) {
applySortProgressToModel();
- QTimer::singleShot(0, this, SLOT(resolveNextSortRole()));
+ QTimer::singleShot(0, this, &KFileItemModelRolesUpdater::resolveNextSortRole);
} else {
m_state = Idle;
}
if (!m_pendingIndexes.isEmpty()) {
- QTimer::singleShot(0, this, SLOT(resolveNextPendingRoles()));
+ QTimer::singleShot(0, this, &KFileItemModelRolesUpdater::resolveNextPendingRoles);
} else {
m_state = Idle;
m_pendingIndexes = indexes;
// Trigger the asynchronous resolving of all roles.
m_state = ResolvingAllRoles;
- QTimer::singleShot(0, this, SLOT(resolveNextPendingRoles()));
+ QTimer::singleShot(0, this, &KFileItemModelRolesUpdater::resolveNextPendingRoles);
}
}
m_state = PreviewJobRunning;
if (m_pendingPreviewItems.isEmpty()) {
- QTimer::singleShot(0, this, SLOT(slotPreviewJobFinished()));
+ QTimer::singleShot(0, this, &KFileItemModelRolesUpdater::slotPreviewJobFinished);
return;
}
// asynchronous determination of the sort role.
killPreviewJob();
m_state = ResolvingSortRole;
- QTimer::singleShot(0, this, SLOT(resolveNextSortRole()));
+ QTimer::singleShot(0, this, &KFileItemModelRolesUpdater::resolveNextSortRole);
}
return;
if (!resolvingInProgress) {
// Trigger the asynchronous resolving of the changed roles.
m_state = ResolvingAllRoles;
- QTimer::singleShot(0, this, SLOT(resolveNextPendingRoles()));
+ QTimer::singleShot(0, this, &KFileItemModelRolesUpdater::resolveNextPendingRoles);
}
}
}
*/
class KItemListContainerViewport : public QGraphicsView
{
+ Q_OBJECT
+
public:
KItemListContainerViewport(QGraphicsScene* scene, QWidget* parent);
protected:
}
}
+#include "kitemlistcontainer.moc"
const KItemSet previous = m_selectedItems;
m_selectedItems.clear();
- foreach (int index, previous) {
+ for (int index: previous) {
int inc = 0;
foreach (const KItemRange& itemRange, itemRanges) {
if (index < itemRange.index) {
const KItemSet previous = m_selectedItems;
m_selectedItems.clear();
- foreach (int oldIndex, previous) {
+ for (int oldIndex : previous) {
const int index = indexAfterRangesRemoving(oldIndex, itemRanges, DiscardRemovedIndex);
if (index >= 0) {
m_selectedItems.insert(index);
const KItemSet previous = m_selectedItems;
m_selectedItems.clear();
- foreach (int index, previous) {
+ for (int index : previous) {
if (index >= itemRange.index && index < itemRange.index + itemRange.count) {
m_selectedItems.insert(movedToIndexes.at(index - itemRange.index));
}
QList<QAccessibleInterface*> KItemListViewAccessible::selectedCells() const
{
QList<QAccessibleInterface*> cells;
- Q_FOREACH (int index, view()->controller()->selectionManager()->selectedItems()) {
+ const auto items = view()->controller()->selectionManager()->selectedItems();
+ cells.reserve(items.count());
+ for (int index : items) {
cells.append(cell(index));
}
return cells;
const QGraphicsScene* scene = view()->scene();
if (scene) {
- const QPoint origin = scene->views()[0]->mapToGlobal(QPoint(0, 0));
+ const QPoint origin = scene->views().at(0)->mapToGlobal(QPoint(0, 0));
const QRect viewRect = view()->geometry().toRect();
return viewRect.translated(origin);
} else {
* or KItemListWidget::expansionToggleRect().
* @reimp
*/
- virtual bool contains(const QPointF& point) const;
+ virtual bool contains(const QPointF& point) const override;
/**
* @return Rectangle for the area that shows the icon.
public:
KItemSet();
KItemSet(const KItemSet& other);
+ ~KItemSet();
+ KItemSet& operator=(const KItemSet& other);
/**
* Returns the number of items in the set.
return *this;
}
+ ~iterator() = default;
+
int operator*() const
{
return m_rangeIt->index + m_offset;
return *this;
}
+ ~const_iterator() = default;
+
int operator*() const
{
return m_rangeIt->index + m_offset;
{
}
+inline KItemSet::~KItemSet() = default;
+
+inline KItemSet& KItemSet::operator=(const KItemSet& other)
+{
+ m_itemRanges=other.m_itemRanges;
+ return *this;
+}
+
inline int KItemSet::count() const
{
int result = 0;
// The URL might have changed (i.e., if the sort order of the items has
// been changed). Therefore, the "is cut" state must be updated.
KFileItemClipboard* clipboard = KFileItemClipboard::instance();
- const QUrl itemUrl = data().value("url").value<QUrl>();
+ const QUrl itemUrl = data().value("url").toUrl();
m_isCut = clipboard->isCut(itemUrl);
// The icon-state might depend from other roles and hence is
// Listen to changes of the clipboard to mark the item as cut/uncut
KFileItemClipboard* clipboard = KFileItemClipboard::instance();
- const QUrl itemUrl = data().value("url").value<QUrl>();
+ const QUrl itemUrl = data().value("url").toUrl();
m_isCut = clipboard->isCut(itemUrl);
connect(clipboard, &KFileItemClipboard::cutItemsChanged,
void KStandardItemListWidget::slotCutItemsChanged()
{
- const QUrl itemUrl = data().value("url").value<QUrl>();
+ const QUrl itemUrl = data().value("url").toUrl();
const bool isCut = KFileItemClipboard::instance()->isCut(itemUrl);
if (m_isCut != isCut) {
m_isCut = isCut;
if (iconName.isEmpty()) {
// The icon-name has not been not resolved by KFileItemModelRolesUpdater,
// use a generic icon as fallback
- iconName = QLatin1String("unknown");
+ iconName = QStringLiteral("unknown");
}
const QStringList overlays = values["iconOverlays"].toStringList();
m_pixmap = pixmapForIcon(iconName, overlays, maxIconHeight);
if (m_isExpandable) {
option.state |= QStyle::State_Children;
}
- if (data()["isExpanded"].toBool()) {
+ if (data().value("isExpanded").toBool()) {
option.state |= QStyle::State_Open;
}
isItemSibling = false;
QPixmap KStandardItemListWidget::pixmapForIcon(const QString& name, const QStringList& overlays, int size)
{
size *= qApp->devicePixelRatio();
- const QString key = "KStandardItemListWidget:" % name % ":" % overlays.join(":") % ":" % QString::number(size);
+ const QString key = "KStandardItemListWidget:" % name % ":" % overlays.join(QStringLiteral(":")) % ":" % QString::number(size);
QPixmap pixmap;
if (!QPixmapCache::find(key, pixmap)) {
void setSupportsItemExpanding(bool supportsItemExpanding);
bool supportsItemExpanding() const;
- virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0);
+ virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0) override;
virtual QRectF iconRect() const Q_DECL_OVERRIDE;
virtual QRectF textRect() const Q_DECL_OVERRIDE;
QString KBalooRolesProvider::tagsFromValues(const QStringList& values) const
{
- return values.join(", ");
+ return values.join(QStringLiteral(", "));
}
QString KBalooRolesProvider::orientationFromValue(int value) const
{
QTime duration;
duration = duration.addSecs(value);
- return duration.toString("hh:mm:ss");
+ return duration.toString(QStringLiteral("hh:mm:ss"));
}
return;
}
- const QByteArray data = mimeData->data("application/x-kde-cutselection");
+ const QByteArray data = mimeData->data(QStringLiteral("application/x-kde-cutselection"));
const bool isCutSelection = (!data.isEmpty() && data.at(0) == QLatin1Char('1'));
if (isCutSelection) {
m_cutItems = KUrlMimeData::urlsFromMimeData(mimeData).toSet();
void KItemListSelectionToggle::updatePixmap()
{
- const QString icon = m_checked ? "list-remove" : "list-add";
+ const QString icon = m_checked ? QStringLiteral("list-remove") : QStringLiteral("list-add");
const KIconLoader::States state = m_hovered ? KIconLoader::ActiveState : KIconLoader::DisabledState;
m_pixmap = KIconLoader::global()->loadIcon(icon, KIconLoader::Desktop, iconSize(), state);
}
{
QApplication app(argc, argv);
app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
- app.setWindowIcon(QIcon::fromTheme("system-file-manager"));
+ app.setWindowIcon(QIcon::fromTheme(QStringLiteral("system-file-manager")));
KCrash::initialize();
KLocalizedString::setApplicationDomain("dolphin");
- KAboutData aboutData("dolphin", i18n("Dolphin"), QStringLiteral(DOLPHIN_VERSION_STRING),
+ KAboutData aboutData(QStringLiteral("dolphin"), i18n("Dolphin"), QStringLiteral(DOLPHIN_VERSION_STRING),
i18nc("@title", "File Manager"),
KAboutLicense::GPL,
i18nc("@info:credit", "(C) 2006-2016 Peter Penz, Frank Reininghaus, and Emmanuel Pescosta"));
- aboutData.setHomepage("http://dolphin.kde.org");
+ aboutData.setHomepage(QStringLiteral("http://dolphin.kde.org"));
aboutData.addAuthor(i18nc("@info:credit", "Emmanuel Pescosta"),
i18nc("@info:credit", "Maintainer (since 2014) and developer"),
- "emmanuelpescosta099@gmail.com");
+ QStringLiteral("emmanuelpescosta099@gmail.com"));
aboutData.addAuthor(i18nc("@info:credit", "Frank Reininghaus"),
i18nc("@info:credit", "Maintainer (2012-2014) and developer"),
- "frank78ac@googlemail.com");
+ QStringLiteral("frank78ac@googlemail.com"));
aboutData.addAuthor(i18nc("@info:credit", "Peter Penz"),
i18nc("@info:credit", "Maintainer and developer (2006-2012)"),
- "peter.penz19@gmail.com");
+ QStringLiteral("peter.penz19@gmail.com"));
aboutData.addAuthor(i18nc("@info:credit", "Sebastian Trüg"),
i18nc("@info:credit", "Developer"),
- "trueg@kde.org");
+ QStringLiteral("trueg@kde.org"));
aboutData.addAuthor(i18nc("@info:credit", "David Faure"),
i18nc("@info:credit", "Developer"),
- "faure@kde.org");
+ QStringLiteral("faure@kde.org"));
aboutData.addAuthor(i18nc("@info:credit", "Aaron J. Seigo"),
i18nc("@info:credit", "Developer"),
- "aseigo@kde.org");
+ QStringLiteral("aseigo@kde.org"));
aboutData.addAuthor(i18nc("@info:credit", "Rafael Fernández López"),
i18nc("@info:credit", "Developer"),
- "ereslibre@kde.org");
+ QStringLiteral("ereslibre@kde.org"));
aboutData.addAuthor(i18nc("@info:credit", "Kevin Ottens"),
i18nc("@info:credit", "Developer"),
- "ervin@kde.org");
+ QStringLiteral("ervin@kde.org"));
aboutData.addAuthor(i18nc("@info:credit", "Holger Freyther"),
i18nc("@info:credit", "Developer"),
- "freyther@gmx.net");
+ QStringLiteral("freyther@gmx.net"));
aboutData.addAuthor(i18nc("@info:credit", "Max Blazejak"),
i18nc("@info:credit", "Developer"),
- "m43ksrocks@gmail.com");
+ QStringLiteral("m43ksrocks@gmail.com"));
aboutData.addAuthor(i18nc("@info:credit", "Michael Austin"),
i18nc("@info:credit", "Documentation"),
- "tuxedup@users.sourceforge.net");
+ QStringLiteral("tuxedup@users.sourceforge.net"));
KAboutData::setApplicationData(aboutData);
aboutData.setupCommandLine(&parser);
// command line options
- parser.addOption(QCommandLineOption(QStringList() << QLatin1String("select"), i18nc("@info:shell", "The files and directories passed as arguments "
+ parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("select"), i18nc("@info:shell", "The files and directories passed as arguments "
"will be selected.")));
- parser.addOption(QCommandLineOption(QStringList() << QLatin1String("split"), i18nc("@info:shell", "Dolphin will get started with a split view.")));
- parser.addOption(QCommandLineOption(QStringList() << QLatin1String("daemon"), i18nc("@info:shell", "Start Dolphin Daemon (only required for DBus Interface)")));
- parser.addPositionalArgument(QLatin1String("+[Url]"), i18nc("@info:shell", "Document to open"));
+ parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("split"), i18nc("@info:shell", "Dolphin will get started with a split view.")));
+ parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("daemon"), i18nc("@info:shell", "Start Dolphin Daemon (only required for DBus Interface)")));
+ parser.addPositionalArgument(QStringLiteral("+[Url]"), i18nc("@info:shell", "Document to open"));
parser.process(app);
aboutData.processCommandLine(&parser);
- if (parser.isSet("daemon")) {
+ if (parser.isSet(QStringLiteral("daemon"))) {
return app.exec();
}
urls.append(Dolphin::homeUrl());
}
- const bool splitView = parser.isSet("split") || GeneralSettings::splitView();
+ const bool splitView = parser.isSet(QStringLiteral("split")) || GeneralSettings::splitView();
if (splitView && urls.size() < 2) {
// Split view does only make sense if we have at least 2 URLs
urls.append(urls.last());
DolphinMainWindow* mainWindow = new DolphinMainWindow();
mainWindow->setAttribute(Qt::WA_DeleteOnClose);
- if (parser.isSet("select")) {
+ if (parser.isSet(QStringLiteral("select"))) {
mainWindow->openFiles(urls, splitView);
} else {
mainWindow->openDirectories(urls, splitView);
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;
// 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) {
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);
// 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);
}
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);
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);
}
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);
}
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",
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);
}
}
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);
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());
}
KIconLoader iconLoader;
- QPixmap icon = iconLoader.loadIcon("dialog-information",
+ QPixmap icon = iconLoader.loadIcon(QStringLiteral("dialog-information"),
KIconLoader::NoGroup,
KIconLoader::SizeEnormous);
m_preview->setPixmap(icon);
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) {
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()) {
class EmbeddedVideoPlayer : public Phonon::VideoWidget
{
+ Q_OBJECT
+
public:
EmbeddedVideoPlayer(QWidget *parent = 0) :
Phonon::VideoWidget(parent)
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);
m_videoPlayer->setSizeHint(m_videoSize);
}
}
+
+#include "phononwidget.moc"
// 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
QUrl PlacesItem::url() const
{
- return dataValue("url").value<QUrl>();
+ return dataValue("url").toUrl();
}
void PlacesItem::setUdi(const QString& udi)
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()));
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"));
}
}
default: Q_ASSERT(false); break;
}
- setHidden(bookmark.metaDataItem("IsHidden") == QLatin1String("true"));
+ setHidden(bookmark.metaDataItem(QStringLiteral("IsHidden")) == QLatin1String("true"));
}
KBookmark PlacesItem::bookmark() const
KBookmark bookmark = root.addBookmark(text, url, iconName);
bookmark.setFullText(text);
- bookmark.setMetaDataItem("ID", generateNewId());
+ bookmark.setMetaDataItem(QStringLiteral("ID"), generateNewId());
return bookmark;
}
}
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;
}
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) {
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)
} 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"));
}
}
// " (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)";
}
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);
{
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;
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()) {
QDataStream stream(&itemData, QIODevice::WriteOnly);
- foreach (int index, indexes) {
+ for (int index : indexes) {
const QUrl itemUrl = placesItem(index)->url();
if (itemUrl.isValid()) {
urls << itemUrl;
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) {
}
if ((url.isLocalFile() && !QFileInfo(url.toLocalFile()).isDir())
- || url.scheme() == "trash") {
+ || url.scheme() == QLatin1String("trash")) {
// Only directories outside the trash are allowed
continue;
}
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));
}
}
}
// 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()));
}
}
if (!found) {
- const QString udi = newBookmark.metaDataItem("UDI");
+ const QString udi = newBookmark.metaDataItem(QStringLiteral("UDI"));
/*
* See Bug 304878
}
// 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));
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()
// 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);
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"});
}
// 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")));
}
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']");
}
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"));
}
}
#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);
}
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;
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));
{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) {
{
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) {
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)
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"));
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);
} 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));
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
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();
}
m_sendCdToTerminalHistory.enqueue(QDir(dir).canonicalPath());
if (m_clearTerminal) {
- m_terminal->sendInput(" clear\n");
+ m_terminal->sendInput(QStringLiteral(" clear\n"));
m_clearTerminal = false;
}
}
}
const int rating = stars * 2;
- terms << QString::fromLatin1("rating>=%1").arg(rating);
+ terms << QStringLiteral("rating>=%1").arg(rating);
}
if (!m_anytime->isChecked()) {
date = date.addDays(1 - date.dayOfYear());
}
- terms << QString::fromLatin1("modified>=%1").arg(date.toString(Qt::ISODate));
+ terms << QStringLiteral("modified>=%1").arg(date.toString(Qt::ISODate));
}
return terms.join(QStringLiteral(" AND "));
QString DolphinFacetsWidget::facetType() const
{
if (m_documents->isChecked()) {
- return QLatin1String("Document");
+ return QStringLiteral("Document");
} else if (m_images->isChecked()) {
- return QLatin1String("Image");
+ return QStringLiteral("Image");
} else if (m_audio->isChecked()) {
- return QLatin1String("Audio");
+ return QStringLiteral("Audio");
} else if (m_videos->isChecked()) {
- return QLatin1String("Video");
+ return QStringLiteral("Video");
}
return QString();
bool containsModified = false;
foreach (const QString& subTerm, subTerms) {
- if (subTerm.startsWith("rating>=")) {
+ if (subTerm.startsWith(QLatin1String("rating>="))) {
containsRating = true;
- } else if (subTerm.startsWith("modified>=")) {
+ } else if (subTerm.startsWith(QLatin1String("modified>="))) {
containsModified = true;
}
}
QStringList subTerms = term.split(' ', QString::SkipEmptyParts);
foreach (const QString& subTerm, subTerms) {
- if (subTerm.startsWith("modified>=")) {
+ if (subTerm.startsWith(QLatin1String("modified>="))) {
const QString value = subTerm.mid(10);
const QDate date = QDate::fromString(value, Qt::ISODate);
setTimespan(date);
- } else if (subTerm.startsWith("rating>=")) {
+ } else if (subTerm.startsWith(QLatin1String("rating>="))) {
const QString value = subTerm.mid(8);
const int stars = value.toInt() / 2;
setRating(stars);
QString location = url.fileName();
if (location.isEmpty()) {
if (url.isLocalFile()) {
- location = QLatin1String("/");
+ location = QStringLiteral("/");
} else {
location = url.scheme() + QLatin1String(" - ") + url.host();
}
if (useBalooSearch) {
url = balooUrlForSearching();
} else {
- url.setScheme("filenamesearch");
+ url.setScheme(QStringLiteral("filenamesearch"));
QUrlQuery query;
- query.addQueryItem("search", m_searchInput->text());
+ query.addQueryItem(QStringLiteral("search"), m_searchInput->text());
if (m_contentButton->isChecked()) {
- query.addQueryItem("checkContent", "yes");
+ query.addQueryItem(QStringLiteral("checkContent"), QStringLiteral("yes"));
}
QString encodedUrl;
} else {
encodedUrl = m_searchPath.url();
}
- query.addQueryItem("url", encodedUrl);
+ query.addQueryItem(QStringLiteral("url"), encodedUrl);
url.setQuery(query);
}
void DolphinSearchBox::fromSearchUrl(const QUrl& url)
{
- if (url.scheme() == "baloosearch") {
+ if (url.scheme() == QLatin1String("baloosearch")) {
fromBalooSearchUrl(url);
- } else if (url.scheme() == "filenamesearch") {
+ } else if (url.scheme() == QLatin1String("filenamesearch")) {
const QUrlQuery query(url);
- setText(query.queryItemValue("search"));
- setSearchPath(QUrl::fromUserInput(query.queryItemValue("url"), QString(), QUrl::AssumeLocalFile));
- m_contentButton->setChecked(query.queryItemValue("checkContent") == "yes");
+ setText(query.queryItemValue(QStringLiteral("search")));
+ setSearchPath(QUrl::fromUserInput(query.queryItemValue(QStringLiteral("url")), QString(), QUrl::AssumeLocalFile));
+ m_contentButton->setChecked(query.queryItemValue(QStringLiteral("checkContent")) == QLatin1String("yes"));
} else {
setText(QString());
setSearchPath(url);
void DolphinSearchBox::saveSettings()
{
- SearchSettings::setLocation(m_fromHereButton->isChecked() ? "FromHere" : "Everywhere");
- SearchSettings::setWhat(m_fileNameButton->isChecked() ? "FileName" : "Content");
+ SearchSettings::setLocation(m_fromHereButton->isChecked() ? QStringLiteral("FromHere") : QStringLiteral("Everywhere"));
+ SearchSettings::setWhat(m_fileNameButton->isChecked() ? QStringLiteral("FileName") : QStringLiteral("Content"));
SearchSettings::setShowFacetsWidget(m_facetsToggleButton->isChecked());
SearchSettings::self()->save();
}
// Create close button
QToolButton* closeButton = new QToolButton(this);
closeButton->setAutoRaise(true);
- closeButton->setIcon(QIcon::fromTheme("dialog-close"));
+ closeButton->setIcon(QIcon::fromTheme(QStringLiteral("dialog-close")));
closeButton->setToolTip(i18nc("@info:tooltip", "Quit searching"));
connect(closeButton, &QToolButton::clicked, this, &DolphinSearchBox::emitCloseRequest);
if (m_contentButton->isChecked()) {
queryStrings << text;
} else if (!text.isEmpty()) {
- queryStrings << QString::fromLatin1("filename:\"%1\"").arg(text);
+ queryStrings << QStringLiteral("filename:\"%1\"").arg(text);
}
if (m_fromHereButton->isChecked()) {
query.setIncludeFolder(m_searchPath.toLocalFile());
}
- query.setSearchString(queryStrings.join(" "));
+ query.setSearchString(queryStrings.join(QStringLiteral(" ")));
return query.toSearchUrl(i18nc("@title UDS_DISPLAY_NAME for a KIO directory listing. %1 is the query the user entered.",
"Query Results from '%1'", text));
const QStringList subTerms = query.searchString().split(' ', QString::SkipEmptyParts);
foreach (const QString& subTerm, subTerms) {
- if (subTerm.startsWith("filename:")) {
+ if (subTerm.startsWith(QLatin1String("filename:"))) {
const QString value = subTerm.mid(9);
setText(value);
} else if (m_facetsWidget->isRatingTerm(subTerm)) {
{
const bool facetsIsVisible = SearchSettings::showFacetsWidget();
m_facetsToggleButton->setChecked(facetsIsVisible ? true : false);
- m_facetsToggleButton->setIcon(QIcon::fromTheme(facetsIsVisible ? "arrow-up-double" : "arrow-down-double"));
+ m_facetsToggleButton->setIcon(QIcon::fromTheme(facetsIsVisible ? QStringLiteral("arrow-up-double") : QStringLiteral("arrow-down-double")));
m_facetsToggleButton->setText(facetsIsVisible ? i18nc("action:button", "Fewer Options") : i18nc("action:button", "More Options"));
}
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
okButton->setDefault(true);
- const KConfigGroup dialogConfig(KSharedConfig::openConfig("dolphinrc"), "AdditionalInfoDialog");
+ const KConfigGroup dialogConfig(KSharedConfig::openConfig(QStringLiteral("dolphinrc")), "AdditionalInfoDialog");
KWindowConfig::restoreWindowSize(windowHandle(), dialogConfig);
}
AdditionalInfoDialog::~AdditionalInfoDialog()
{
- KConfigGroup dialogConfig(KSharedConfig::openConfig("dolphinrc"), "AdditionalInfoDialog");
+ KConfigGroup dialogConfig(KSharedConfig::openConfig(QStringLiteral("dolphinrc")), "AdditionalInfoDialog");
KWindowConfig::saveWindowSize(windowHandle(), dialogConfig);
}
StartupSettingsPage* startupSettingsPage = new StartupSettingsPage(url, this);
KPageWidgetItem* startupSettingsFrame = addPage(startupSettingsPage,
i18nc("@title:group", "Startup"));
- startupSettingsFrame->setIcon(QIcon::fromTheme("go-home"));
+ startupSettingsFrame->setIcon(QIcon::fromTheme(QStringLiteral("go-home")));
connect(startupSettingsPage, &StartupSettingsPage::changed, this, &DolphinSettingsDialog::enableApply);
// View Modes
ViewSettingsPage* viewSettingsPage = new ViewSettingsPage(this);
KPageWidgetItem* viewSettingsFrame = addPage(viewSettingsPage,
i18nc("@title:group", "View Modes"));
- viewSettingsFrame->setIcon(QIcon::fromTheme("view-choose"));
+ viewSettingsFrame->setIcon(QIcon::fromTheme(QStringLiteral("view-choose")));
connect(viewSettingsPage, &ViewSettingsPage::changed, this, &DolphinSettingsDialog::enableApply);
// Navigation
NavigationSettingsPage* navigationSettingsPage = new NavigationSettingsPage(this);
KPageWidgetItem* navigationSettingsFrame = addPage(navigationSettingsPage,
i18nc("@title:group", "Navigation"));
- navigationSettingsFrame->setIcon(QIcon::fromTheme("edit-select"));
+ navigationSettingsFrame->setIcon(QIcon::fromTheme(QStringLiteral("edit-select")));
connect(navigationSettingsPage, &NavigationSettingsPage::changed, this, &DolphinSettingsDialog::enableApply);
// Services
ServicesSettingsPage* servicesSettingsPage = new ServicesSettingsPage(this);
KPageWidgetItem* servicesSettingsFrame = addPage(servicesSettingsPage,
i18nc("@title:group", "Services"));
- servicesSettingsFrame->setIcon(QIcon::fromTheme("flag"));
+ servicesSettingsFrame->setIcon(QIcon::fromTheme(QStringLiteral("flag")));
connect(servicesSettingsPage, &ServicesSettingsPage::changed, this, &DolphinSettingsDialog::enableApply);
// Trash
TrashSettingsPage* trashSettingsPage = new TrashSettingsPage(this);
KPageWidgetItem* trashSettingsFrame = addPage(trashSettingsPage,
i18nc("@title:group", "Trash"));
- trashSettingsFrame->setIcon(QIcon::fromTheme("trash-empty"));
+ trashSettingsFrame->setIcon(QIcon::fromTheme(QStringLiteral("trash-empty")));
connect(trashSettingsPage, &TrashSettingsPage::changed, this, &DolphinSettingsDialog::enableApply);
// General
GeneralSettingsPage* generalSettingsPage = new GeneralSettingsPage(url, this);
KPageWidgetItem* generalSettingsFrame = addPage(generalSettingsPage,
i18nc("@title:group General settings", "General"));
- generalSettingsFrame->setIcon(QIcon::fromTheme("view-preview"));
+ generalSettingsFrame->setIcon(QIcon::fromTheme(QStringLiteral("view-preview")));
connect(generalSettingsPage, &GeneralSettingsPage::changed, this, &DolphinSettingsDialog::enableApply);
m_pages.append(startupSettingsPage);
m_pages.append(trashSettingsPage);
m_pages.append(generalSettingsPage);
- const KConfigGroup dialogConfig(KSharedConfig::openConfig("dolphinrc"), "SettingsDialog");
+ const KConfigGroup dialogConfig(KSharedConfig::openConfig(QStringLiteral("dolphinrc")), "SettingsDialog");
KWindowConfig::restoreWindowSize(windowHandle(), dialogConfig);
}
DolphinSettingsDialog::~DolphinSettingsDialog()
{
- KConfigGroup dialogConfig(KSharedConfig::openConfig("dolphinrc"), "SettingsDialog");
+ KConfigGroup dialogConfig(KSharedConfig::openConfig(QStringLiteral("dolphinrc")), "SettingsDialog");
KWindowConfig::saveWindowSize(windowHandle(), dialogConfig);
}
void ConfirmationsSettingsPage::applySettings()
{
- KSharedConfig::Ptr kioConfig = KSharedConfig::openConfig("kiorc", KConfig::NoGlobals);
+ KSharedConfig::Ptr kioConfig = KSharedConfig::openConfig(QStringLiteral("kiorc"), KConfig::NoGlobals);
KConfigGroup confirmationGroup(kioConfig, "Confirmations");
confirmationGroup.writeEntry("ConfirmTrash", m_confirmMoveToTrash->isChecked());
confirmationGroup.writeEntry("ConfirmDelete", m_confirmDelete->isChecked());
void ConfirmationsSettingsPage::loadSettings()
{
- KSharedConfig::Ptr kioConfig = KSharedConfig::openConfig("kiorc", KConfig::IncludeGlobals);
+ KSharedConfig::Ptr kioConfig = KSharedConfig::openConfig(QStringLiteral("kiorc"), KConfig::IncludeGlobals);
const KConfigGroup confirmationGroup(kioConfig, "Confirmations");
m_confirmMoveToTrash->setChecked(confirmationGroup.readEntry("ConfirmTrash", ConfirmTrash));
m_confirmDelete->setChecked(confirmationGroup.readEntry("ConfirmDelete", ConfirmDelete));
- const KConfigGroup scriptExecutionGroup(KSharedConfig::openConfig("kiorc"), "Executable scripts");
+ const KConfigGroup scriptExecutionGroup(KSharedConfig::openConfig(QStringLiteral("kiorc")), "Executable scripts");
const QString value = scriptExecutionGroup.readEntry("behaviourOnLaunch", "alwaysAsk");
- m_confirmScriptExecution->setChecked(value == "alwaysAsk");
+ m_confirmScriptExecution->setChecked(value == QLatin1String("alwaysAsk"));
m_confirmClosingMultipleTabs->setChecked(GeneralSettings::confirmClosingMultipleTabs());
}
m_remoteFileSizeBox = new QSpinBox(this);
m_remoteFileSizeBox->setSingleStep(1);
- m_remoteFileSizeBox->setSuffix(QLatin1String(" MB"));
+ m_remoteFileSizeBox->setSuffix(QStringLiteral(" MB"));
m_remoteFileSizeBox->setRange(0, 9999999); /* MB */
QHBoxLayout* fileSizeBoxLayout = new QHBoxLayout(this);
}
}
- KConfigGroup globalConfig(KSharedConfig::openConfig(), QLatin1String("PreviewSettings"));
+ KConfigGroup globalConfig(KSharedConfig::openConfig(), QStringLiteral("PreviewSettings"));
globalConfig.writeEntry("Plugins", m_enabledPreviewPlugins);
const qulonglong maximumRemoteSize = static_cast<qulonglong>(m_remoteFileSizeBox->value()) * 1024 * 1024;
{
QAbstractItemModel* model = m_listView->model();
- const KService::List plugins = KServiceTypeTrader::self()->query(QLatin1String("ThumbCreator"));
+ const KService::List plugins = KServiceTypeTrader::self()->query(QStringLiteral("ThumbCreator"));
foreach (const KService::Ptr& service, plugins) {
- const bool configurable = service->property("Configurable", QVariant::Bool).toBool();
+ const bool configurable = service->property(QStringLiteral("Configurable"), QVariant::Bool).toBool();
const bool show = m_enabledPreviewPlugins.contains(service->desktopEntryName());
model->insertRow(0);
{
KConfigGroup globalConfig(KSharedConfig::openConfig(), "PreviewSettings");
m_enabledPreviewPlugins = globalConfig.readEntry("Plugins", QStringList()
- << QLatin1String("directorythumbnail")
- << QLatin1String("imagethumbnail")
- << QLatin1String("jpegthumbnail"));
+ << QStringLiteral("directorythumbnail")
+ << QStringLiteral("imagethumbnail")
+ << QStringLiteral("jpegthumbnail"));
const qulonglong defaultRemotePreview = static_cast<qulonglong>(MaxRemotePreviewSize) * 1024 * 1024;
const qulonglong maxRemoteByteSize = globalConfig.readEntry("MaximumRemoteSize", defaultRemotePreview);
#include <QVBoxLayout>
#include <QTabWidget>
-K_PLUGIN_FACTORY(KCMDolphinGeneralConfigFactory, registerPlugin<DolphinGeneralConfigModule>("dolphingeneral");)
+K_PLUGIN_FACTORY(KCMDolphinGeneralConfigFactory, registerPlugin<DolphinGeneralConfigModule>(QStringLiteral("dolphingeneral"));)
K_EXPORT_PLUGIN(KCMDolphinGeneralConfigFactory("kcmdolphingeneral"))
DolphinGeneralConfigModule::DolphinGeneralConfigModule(QWidget* parent, const QVariantList& args) :
#include <QVBoxLayout>
-K_PLUGIN_FACTORY(KCMDolphinNavigationConfigFactory, registerPlugin<DolphinNavigationConfigModule>("dolphinnavigation");)
+K_PLUGIN_FACTORY(KCMDolphinNavigationConfigFactory, registerPlugin<DolphinNavigationConfigModule>(QStringLiteral("dolphinnavigation"));)
K_EXPORT_PLUGIN(KCMDolphinNavigationConfigFactory("kcmdolphinnavigation"))
DolphinNavigationConfigModule::DolphinNavigationConfigModule(QWidget* parent, const QVariantList& args) :
#include <QVBoxLayout>
-K_PLUGIN_FACTORY(KCMDolphinServicesConfigFactory, registerPlugin<DolphinServicesConfigModule>("dolphinservices");)
+K_PLUGIN_FACTORY(KCMDolphinServicesConfigFactory, registerPlugin<DolphinServicesConfigModule>(QStringLiteral("dolphinservices"));)
K_EXPORT_PLUGIN(KCMDolphinServicesConfigFactory("kcmdolphinservices"))
DolphinServicesConfigModule::DolphinServicesConfigModule(QWidget* parent, const QVariantList& args) :
#include <QVBoxLayout>
#include <QTabWidget>
-K_PLUGIN_FACTORY(KCMDolphinViewModesConfigFactory, registerPlugin<DolphinViewModesConfigModule>("dolphinviewmodes");)
+K_PLUGIN_FACTORY(KCMDolphinViewModesConfigFactory, registerPlugin<DolphinViewModesConfigModule>(QStringLiteral("dolphinviewmodes"));)
K_EXPORT_PLUGIN(KCMDolphinViewModesConfigFactory("kcmdolphinviewmodes"))
DolphinViewModesConfigModule::DolphinViewModesConfigModule(QWidget* parent, const QVariantList& args) :
// Initialize 'Icons' tab
ViewSettingsTab* iconsTab = new ViewSettingsTab(ViewSettingsTab::IconsMode, tabWidget);
- tabWidget->addTab(iconsTab, QIcon::fromTheme("view-list-icons"), i18nc("@title:tab", "Icons"));
+ tabWidget->addTab(iconsTab, QIcon::fromTheme(QStringLiteral("view-list-icons")), i18nc("@title:tab", "Icons"));
connect(iconsTab, &ViewSettingsTab::changed, this, &DolphinViewModesConfigModule::viewModeChanged);
// Initialize 'Compact' tab
ViewSettingsTab* compactTab = new ViewSettingsTab(ViewSettingsTab::CompactMode, tabWidget);
- tabWidget->addTab(compactTab, QIcon::fromTheme("view-list-details"), i18nc("@title:tab", "Compact"));
+ tabWidget->addTab(compactTab, QIcon::fromTheme(QStringLiteral("view-list-details")), i18nc("@title:tab", "Compact"));
connect(compactTab, &ViewSettingsTab::changed, this, &DolphinViewModesConfigModule::viewModeChanged);
// Initialize 'Details' tab
ViewSettingsTab* detailsTab = new ViewSettingsTab(ViewSettingsTab::DetailsMode, tabWidget);
- tabWidget->addTab(detailsTab, QIcon::fromTheme("view-list-tree"), i18nc("@title:tab", "Details"));
+ tabWidget->addTab(detailsTab, QIcon::fromTheme(QStringLiteral("view-list-tree")), i18nc("@title:tab", "Details"));
connect(detailsTab, &ViewSettingsTab::changed, this, &DolphinViewModesConfigModule::viewModeChanged);
m_tabs.append(iconsTab);
void DolphinViewModesConfigModule::reparseConfiguration()
{
- QDBusMessage message = QDBusMessage::createSignal("/KonqMain", "org.kde.Konqueror.Main", "reparseConfiguration");
+ QDBusMessage message = QDBusMessage::createSignal(QStringLiteral("/KonqMain"), QStringLiteral("org.kde.Konqueror.Main"), QStringLiteral("reparseConfiguration"));
QDBusConnection::sessionBus().send(message);
}
// Update the configuration button
if (configurable) {
configureButton->setEnabled(checkBox->isChecked());
- configureButton->setIcon(QIcon::fromTheme("configure"));
+ configureButton->setIcon(QIcon::fromTheme(QStringLiteral("configure")));
configureButton->resize(configureButton->sizeHint());
configureButton->move(option.rect.right() - configureButton->width(),
(itemHeight - configureButton->height()) / 2);
connect(m_listView, &QListView::clicked, this, &ServicesSettingsPage::changed);
KNS3::Button* downloadButton = new KNS3::Button(i18nc("@action:button", "Download New Services..."),
- "servicemenu.knsrc",
+ QStringLiteral("servicemenu.knsrc"),
this);
connect(downloadButton, &KNS3::Button::dialogFinished, this, &ServicesSettingsPage::loadServices);
return;
}
- KConfig config("kservicemenurc", KConfig::NoGlobals);
+ KConfig config(QStringLiteral("kservicemenurc"), KConfig::NoGlobals);
KConfigGroup showGroup = config.group("Show");
QStringList enabledPlugins;
enabledPlugins.append(model->data(index, Qt::DisplayRole).toString());
}
} else if (service == QLatin1String(DeleteService)) {
- KSharedConfig::Ptr globalConfig = KSharedConfig::openConfig("kdeglobals", KConfig::NoGlobals);
+ KSharedConfig::Ptr globalConfig = KSharedConfig::openConfig(QStringLiteral("kdeglobals"), KConfig::NoGlobals);
KConfigGroup configGroup(globalConfig, "KDE");
configGroup.writeEntry("ShowDeleteCommand", checked);
configGroup.sync();
i18nc("@info", "Dolphin must be restarted to apply the "
"updated version control systems settings."),
QString(), // default title
- QLatin1String("ShowVcsRestartInformation"));
+ QStringLiteral("ShowVcsRestartInformation"));
}
}
loadVersionControlSystems();
// Add "Show 'Delete' command" as service
- KSharedConfig::Ptr globalConfig = KSharedConfig::openConfig("kdeglobals", KConfig::IncludeGlobals);
+ KSharedConfig::Ptr globalConfig = KSharedConfig::openConfig(QStringLiteral("kdeglobals"), KConfig::IncludeGlobals);
KConfigGroup configGroup(globalConfig, "KDE");
- addRow("edit-delete",
+ addRow(QStringLiteral("edit-delete"),
i18nc("@option:check", "Delete"),
DeleteService,
configGroup.readEntry("ShowDeleteCommand", ShowDeleteDefault));
// Add "Show 'Copy To' and 'Move To' commands" as service
- addRow("edit-copy",
+ addRow(QStringLiteral("edit-copy"),
i18nc("@option:check", "'Copy To' and 'Move To' commands"),
CopyToMoveToService,
GeneralSettings::showCopyMoveMenu());
void ServicesSettingsPage::loadServices()
{
- const KConfig config("kservicemenurc", KConfig::NoGlobals);
+ const KConfig config(QStringLiteral("kservicemenurc"), KConfig::NoGlobals);
const KConfigGroup showGroup = config.group("Show");
// Load generic services
- const KService::List entries = KServiceTypeTrader::self()->query("KonqPopupMenu/Plugin");
+ const KService::List entries = KServiceTypeTrader::self()->query(QStringLiteral("KonqPopupMenu/Plugin"));
foreach (const KService::Ptr& service, entries) {
const QString file = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "kservices5/" % service->entryPath());
const QList<KServiceAction> serviceActions =
}
// Load service plugins that implement the KFileItemActionPlugin interface
- const KService::List pluginServices = KServiceTypeTrader::self()->query("KFileItemAction/Plugin");
+ const KService::List pluginServices = KServiceTypeTrader::self()->query(QStringLiteral("KFileItemAction/Plugin"));
foreach (const KService::Ptr& service, pluginServices) {
const QString desktopEntryName = service->desktopEntryName();
if (!isInServicesList(desktopEntryName)) {
const QStringList enabledPlugins = VersionControlSettings::enabledPlugins();
// Create a checkbox for each available version control plugin
- const KService::List pluginServices = KServiceTypeTrader::self()->query("FileViewVersionControlPlugin");
+ const KService::List pluginServices = KServiceTypeTrader::self()->query(QStringLiteral("FileViewVersionControlPlugin"));
for (KService::List::ConstIterator it = pluginServices.constBegin(); it != pluginServices.constEnd(); ++it) {
const QString pluginName = (*it)->name();
- addRow("code-class",
+ addRow(QStringLiteral("code-class"),
pluginName,
VersionControlServicePrefix + pluginName,
enabledPlugins.contains(pluginName));
homeUrlBoxLayout->addWidget(m_homeUrl);
m_homeUrl->setClearButtonEnabled(true);
- QPushButton* selectHomeUrlButton = new QPushButton(QIcon::fromTheme("folder-open"), QString(), homeUrlBox);
+ QPushButton* selectHomeUrlButton = new QPushButton(QIcon::fromTheme(QStringLiteral("folder-open")), QString(), homeUrlBox);
homeUrlBoxLayout->addWidget(selectHomeUrlButton);
#ifndef QT_NO_ACCESSIBILITY
QVBoxLayout *vBoxVBoxLayout = new QVBoxLayout(vBox);
vBoxVBoxLayout->setMargin(0);
- m_proxy = new KCModuleProxy("kcmtrash");
+ m_proxy = new KCModuleProxy(QStringLiteral("kcmtrash"));
topLayout->addWidget(m_proxy);
// Add a dummy widget with no restriction regarding
// Initialize 'Icons' tab
ViewSettingsTab* iconsTab = new ViewSettingsTab(ViewSettingsTab::IconsMode, tabWidget);
- tabWidget->addTab(iconsTab, QIcon::fromTheme("view-list-icons"), i18nc("@title:tab", "Icons"));
+ tabWidget->addTab(iconsTab, QIcon::fromTheme(QStringLiteral("view-list-icons")), i18nc("@title:tab", "Icons"));
connect(iconsTab, &ViewSettingsTab::changed, this, &ViewSettingsPage::changed);
// Initialize 'Compact' tab
ViewSettingsTab* compactTab = new ViewSettingsTab(ViewSettingsTab::CompactMode, tabWidget);
- tabWidget->addTab(compactTab, QIcon::fromTheme("view-list-details"), i18nc("@title:tab", "Compact"));
+ tabWidget->addTab(compactTab, QIcon::fromTheme(QStringLiteral("view-list-details")), i18nc("@title:tab", "Compact"));
connect(compactTab, &ViewSettingsTab::changed, this, &ViewSettingsPage::changed);
// Initialize 'Details' tab
ViewSettingsTab* detailsTab = new ViewSettingsTab(ViewSettingsTab::DetailsMode, tabWidget);
- tabWidget->addTab(detailsTab, QIcon::fromTheme("view-list-tree"), i18nc("@title:tab", "Details"));
+ tabWidget->addTab(detailsTab, QIcon::fromTheme(QStringLiteral("view-list-tree")), i18nc("@title:tab", "Details"));
connect(detailsTab, &ViewSettingsTab::changed, this, &ViewSettingsPage::changed);
m_tabs.append(iconsTab);
QLabel* viewModeLabel = new QLabel(i18nc("@label:listbox", "View mode:"), propsGrid);
m_viewMode = new KComboBox(propsGrid);
- m_viewMode->addItem(QIcon::fromTheme("view-list-icons"), i18nc("@item:inlistbox", "Icons"), DolphinView::IconsView);
- m_viewMode->addItem(QIcon::fromTheme("view-list-details"), i18nc("@item:inlistbox", "Compact"), DolphinView::CompactView);
- m_viewMode->addItem(QIcon::fromTheme("view-list-tree"), i18nc("@item:inlistbox", "Details"), DolphinView::DetailsView);
+ m_viewMode->addItem(QIcon::fromTheme(QStringLiteral("view-list-icons")), i18nc("@item:inlistbox", "Icons"), DolphinView::IconsView);
+ m_viewMode->addItem(QIcon::fromTheme(QStringLiteral("view-list-details")), i18nc("@item:inlistbox", "Compact"), DolphinView::CompactView);
+ m_viewMode->addItem(QIcon::fromTheme(QStringLiteral("view-list-tree")), i18nc("@item:inlistbox", "Details"), DolphinView::DetailsView);
QLabel* sortingLabel = new QLabel(i18nc("@label:listbox", "Sorting:"), propsGrid);
QWidget* sortingBox = new QWidget(propsGrid);
applyButton->setEnabled(isDirty);
});
- const KConfigGroup dialogConfig(KSharedConfig::openConfig("dolphinrc"), "ViewPropertiesDialog");
+ const KConfigGroup dialogConfig(KSharedConfig::openConfig(QStringLiteral("dolphinrc")), "ViewPropertiesDialog");
KWindowConfig::restoreWindowSize(windowHandle(), dialogConfig);
loadSettings();
delete m_viewProps;
m_viewProps = 0;
- KConfigGroup dialogConfig(KSharedConfig::openConfig("dolphinrc"), "ViewPropertiesDialog");
+ KConfigGroup dialogConfig(KSharedConfig::openConfig(QStringLiteral("dolphinrc")), "ViewPropertiesDialog");
KWindowConfig::saveWindowSize(windowHandle(), dialogConfig);
}
// Initialize progress information
m_stopButton = new QToolButton(this);
- m_stopButton->setIcon(QIcon::fromTheme("process-stop"));
+ m_stopButton->setIcon(QIcon::fromTheme(QStringLiteral("process-stop")));
m_stopButton->setAccessibleName(i18n("Stop"));
m_stopButton->setAutoRaise(true);
m_stopButton->setToolTip(i18nc("@tooltip", "Stop loading"));
// Note that this object must live long enough in case the user opens
// the "Configure..." dialog
- KMoreToolsMenuFactory menuFactory("dolphin/statusbar-diskspace-menu");
+ KMoreToolsMenuFactory menuFactory(QStringLiteral("dolphin/statusbar-diskspace-menu"));
auto menu = menuFactory.createMenuFromGroupingNames(
{ "disk-usage", "more:", "disk-partitions" }, m_url);
QString iconName;
switch (version) {
case KVersionControlPlugin::NormalVersion:
- iconName = "vcs-normal";
+ iconName = QStringLiteral("vcs-normal");
break;
case KVersionControlPlugin::UpdateRequiredVersion:
- iconName = "vcs-update-required";
+ iconName = QStringLiteral("vcs-update-required");
break;
case KVersionControlPlugin::LocallyModifiedVersion:
- iconName = "vcs-locally-modified";
+ iconName = QStringLiteral("vcs-locally-modified");
break;
case KVersionControlPlugin::LocallyModifiedUnstagedVersion:
- iconName = "vcs-locally-modified-unstaged";
+ iconName = QStringLiteral("vcs-locally-modified-unstaged");
break;
case KVersionControlPlugin::AddedVersion:
- iconName = "vcs-added";
+ iconName = QStringLiteral("vcs-added");
break;
case KVersionControlPlugin::RemovedVersion:
- iconName = "vcs-removed";
+ iconName = QStringLiteral("vcs-removed");
break;
case KVersionControlPlugin::ConflictingVersion:
- iconName = "vcs-conflicting";
+ iconName = QStringLiteral("vcs-conflicting");
break;
case KVersionControlPlugin::UnversionedVersion:
case KVersionControlPlugin::IgnoredVersion:
const KConfigGroup globalConfig(KSharedConfig::openConfig(), "PreviewSettings");
const QStringList plugins = globalConfig.readEntry("Plugins", QStringList()
- << "directorythumbnail"
- << "imagethumbnail"
- << "jpegthumbnail");
+ << QStringLiteral("directorythumbnail")
+ << QStringLiteral("imagethumbnail")
+ << QStringLiteral("jpegthumbnail"));
setEnabledPlugins(plugins);
endTransaction();
#include <KIO/Scheduler>
#include <KConfigGroup>
-#define DATA_KEY QLatin1String("Charset")
+#define DATA_KEY QStringLiteral("Charset")
DolphinRemoteEncoding::DolphinRemoteEncoding(QObject* parent, DolphinViewActionHandler* actionHandler)
:QObject(parent),
m_loaded(false),
m_idDefault(0)
{
- m_menu = new KActionMenu(QIcon::fromTheme("character-set"), i18n("Select Remote Charset"), this);
- m_actionHandler->actionCollection()->addAction("change_remote_encoding", m_menu);
+ m_menu = new KActionMenu(QIcon::fromTheme(QStringLiteral("character-set")), i18n("Select Remote Charset"), this);
+ m_actionHandler->actionCollection()->addAction(QStringLiteral("change_remote_encoding"), m_menu);
connect(m_menu->menu(), &QMenu::aboutToShow,
this, &DolphinRemoteEncoding::slotAboutToShow);
break;
}
- domains << partList.join(".");
+ domains << partList.join(QLatin1Char('.'));
partList.erase(partList.begin());
}
const KItemListSelectionManager* selectionManager = m_container->controller()->selectionManager();
KFileItemList selectedItems;
- foreach (int index, selectionManager->selectedItems()) {
+ const auto items = selectionManager->selectedItems();
+ selectedItems.reserve(items.count());
+ for (int index : items) {
selectedItems.append(m_model->fileItem(index));
}
return selectedItems;
uiDelegate.setWindow(window());
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, this);
connect(job, &KIO::Job::result,
this, &DolphinView::slotTrashFileFinished);
KFileItemList items;
items.reserve(indexes.count());
- foreach (int index, indexes) {
+ for (int index : indexes) {
KFileItem item = m_model->fileItem(index);
const QUrl& url = openItemAsFolderUrl(item);
// Apply the current column-widths as custom column-widths and turn
// off the automatic resizing of the columns
QList<int> columnWidths;
+ columnWidths.reserve(view->visibleRoles().count());
foreach (const QByteArray& role, view->visibleRoles()) {
columnWidths.append(header->columnWidth(role));
}
QList<int> columnWidths;
if (!header->automaticColumnResizing()) {
+ columnWidths.reserve(view->visibleRoles().count());
foreach (const QByteArray& role, view->visibleRoles()) {
columnWidths.append(header->columnWidth(role));
}
const int index = m_model->index(newUrl);
if (index >= 0) {
QHash<QByteArray, QVariant> data;
- const QUrl oldUrl = copyJob->srcUrls().first();
+ const QUrl oldUrl = copyJob->srcUrls().at(0);
data.insert("text", oldUrl.fileName());
m_model->setData(index, data);
}
{
// Update the view-state. This has to be done asynchronously
// because the view might not be in its final state yet.
- QTimer::singleShot(0, this, SLOT(updateViewState()));
+ QTimer::singleShot(0, this, &DolphinView::updateViewState);
emit directoryLoadingCompleted();
QList<QUrl> urls;
const KFileItemList items = selectedItems();
+ urls.reserve(items.count());
foreach (const KFileItem& item, items) {
urls.append(item.url());
}
{
// This action doesn't appear in the GUI, it's for the shortcut only.
// KNewFileMenu takes care of the GUI stuff.
- QAction* newDirAction = m_actionCollection->addAction("create_dir");
+ QAction* newDirAction = m_actionCollection->addAction(QStringLiteral("create_dir"));
newDirAction->setText(i18nc("@action", "Create Folder..."));
m_actionCollection->setDefaultShortcut(newDirAction, Qt::Key_F10);
- newDirAction->setIcon(QIcon::fromTheme("folder-new"));
+ newDirAction->setIcon(QIcon::fromTheme(QStringLiteral("folder-new")));
newDirAction->setEnabled(false); // Will be enabled in slotWriteStateChanged(bool) if the current URL is writable
connect(newDirAction, &QAction::triggered, this, &DolphinViewActionHandler::createDirectory);
// File menu
- QAction* rename = m_actionCollection->addAction("rename");
+ QAction* rename = m_actionCollection->addAction(QStringLiteral("rename"));
rename->setText(i18nc("@action:inmenu File", "Rename..."));
m_actionCollection->setDefaultShortcut(rename, Qt::Key_F2);
- rename->setIcon(QIcon::fromTheme("edit-rename"));
+ rename->setIcon(QIcon::fromTheme(QStringLiteral("edit-rename")));
connect(rename, &QAction::triggered, this, &DolphinViewActionHandler::slotRename);
- QAction* moveToTrash = m_actionCollection->addAction("move_to_trash");
+ QAction* moveToTrash = m_actionCollection->addAction(QStringLiteral("move_to_trash"));
moveToTrash->setText(i18nc("@action:inmenu File", "Move to Trash"));
- moveToTrash->setIcon(QIcon::fromTheme("user-trash"));
+ moveToTrash->setIcon(QIcon::fromTheme(QStringLiteral("user-trash")));
m_actionCollection->setDefaultShortcut(moveToTrash, QKeySequence::Delete);
connect(moveToTrash, &QAction::triggered,
this, &DolphinViewActionHandler::slotTrashActivated);
- QAction* deleteAction = m_actionCollection->addAction("delete");
- deleteAction->setIcon(QIcon::fromTheme("edit-delete"));
+ QAction* deleteAction = m_actionCollection->addAction(QStringLiteral("delete"));
+ deleteAction->setIcon(QIcon::fromTheme(QStringLiteral("edit-delete")));
deleteAction->setText(i18nc("@action:inmenu File", "Delete"));
m_actionCollection->setDefaultShortcut(deleteAction, Qt::SHIFT | Qt::Key_Delete);
connect(deleteAction, &QAction::triggered, this, &DolphinViewActionHandler::slotDeleteItems);
// disabled and "delete" is enabled (e.g. non-local files), so that Key_Del
// can be used for deleting the file (#76016). It needs to be a separate action
// so that the Edit menu isn't affected.
- QAction* deleteWithTrashShortcut = m_actionCollection->addAction("delete_shortcut");
+ QAction* deleteWithTrashShortcut = m_actionCollection->addAction(QStringLiteral("delete_shortcut"));
// The descriptive text is just for the shortcuts editor.
deleteWithTrashShortcut->setText(i18nc("@action \"Move to Trash\" for non-local files, etc.", "Delete (using shortcut for Trash)"));
m_actionCollection->setDefaultShortcut(deleteWithTrashShortcut, QKeySequence::Delete);
deleteWithTrashShortcut->setEnabled(false);
connect(deleteWithTrashShortcut, &QAction::triggered, this, &DolphinViewActionHandler::slotDeleteItems);
- QAction *propertiesAction = m_actionCollection->addAction( "properties" );
+ QAction *propertiesAction = m_actionCollection->addAction( QStringLiteral("properties") );
// Well, it's the File menu in dolphinmainwindow and the Edit menu in dolphinpart... :)
propertiesAction->setText( i18nc("@action:inmenu File", "Properties") );
- propertiesAction->setIcon(QIcon::fromTheme("document-properties"));
+ propertiesAction->setIcon(QIcon::fromTheme(QStringLiteral("document-properties")));
m_actionCollection->setDefaultShortcuts(propertiesAction, {Qt::ALT + Qt::Key_Return, Qt::ALT + Qt::Key_Enter});
connect(propertiesAction, &QAction::triggered, this, &DolphinViewActionHandler::slotProperties);
KToggleAction* compactAction = compactModeAction();
KToggleAction* detailsAction = detailsModeAction();
- KSelectAction* viewModeActions = m_actionCollection->add<KSelectAction>("view_mode");
+ KSelectAction* viewModeActions = m_actionCollection->add<KSelectAction>(QStringLiteral("view_mode"));
viewModeActions->setText(i18nc("@action:intoolbar", "View Mode"));
viewModeActions->addAction(iconsAction);
viewModeActions->addAction(compactAction);
SLOT(zoomOut()),
m_actionCollection);
- KToggleAction* showPreview = m_actionCollection->add<KToggleAction>("show_preview");
+ KToggleAction* showPreview = m_actionCollection->add<KToggleAction>(QStringLiteral("show_preview"));
showPreview->setText(i18nc("@action:intoolbar", "Preview"));
showPreview->setToolTip(i18nc("@info", "Show preview of files and folders"));
- showPreview->setIcon(QIcon::fromTheme("view-preview"));
+ showPreview->setIcon(QIcon::fromTheme(QStringLiteral("view-preview")));
connect(showPreview, &KToggleAction::triggered, this, &DolphinViewActionHandler::togglePreview);
- KToggleAction* sortDescending = m_actionCollection->add<KToggleAction>("descending");
+ KToggleAction* sortDescending = m_actionCollection->add<KToggleAction>(QStringLiteral("descending"));
sortDescending->setText(i18nc("@action:inmenu Sort", "Descending"));
connect(sortDescending, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleSortOrder);
- KToggleAction* sortFoldersFirst = m_actionCollection->add<KToggleAction>("folders_first");
+ KToggleAction* sortFoldersFirst = m_actionCollection->add<KToggleAction>(QStringLiteral("folders_first"));
sortFoldersFirst->setText(i18nc("@action:inmenu Sort", "Folders First"));
connect(sortFoldersFirst, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleSortFoldersFirst);
// View -> Sort By
- QActionGroup* sortByActionGroup = createFileItemRolesActionGroup("sort_by_");
+ QActionGroup* sortByActionGroup = createFileItemRolesActionGroup(QStringLiteral("sort_by_"));
- KActionMenu* sortByActionMenu = m_actionCollection->add<KActionMenu>("sort");
+ KActionMenu* sortByActionMenu = m_actionCollection->add<KActionMenu>(QStringLiteral("sort"));
sortByActionMenu->setText(i18nc("@action:inmenu View", "Sort By"));
sortByActionMenu->setDelayed(false);
sortByActionMenu->addAction(sortFoldersFirst);
// View -> Additional Information
- QActionGroup* visibleRolesGroup = createFileItemRolesActionGroup("show_");
+ QActionGroup* visibleRolesGroup = createFileItemRolesActionGroup(QStringLiteral("show_"));
- KActionMenu* visibleRolesMenu = m_actionCollection->add<KActionMenu>("additional_info");
+ KActionMenu* visibleRolesMenu = m_actionCollection->add<KActionMenu>(QStringLiteral("additional_info"));
visibleRolesMenu->setText(i18nc("@action:inmenu View", "Additional Information"));
visibleRolesMenu->setDelayed(false);
visibleRolesMenu->addAction(action);
}
- KToggleAction* showInGroups = m_actionCollection->add<KToggleAction>("show_in_groups");
- showInGroups->setIcon(QIcon::fromTheme("view-group"));
+ KToggleAction* showInGroups = m_actionCollection->add<KToggleAction>(QStringLiteral("show_in_groups"));
+ showInGroups->setIcon(QIcon::fromTheme(QStringLiteral("view-group")));
showInGroups->setText(i18nc("@action:inmenu View", "Show in Groups"));
connect(showInGroups, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleGroupedSorting);
- KToggleAction* showHiddenFiles = m_actionCollection->add<KToggleAction>("show_hidden_files");
+ KToggleAction* showHiddenFiles = m_actionCollection->add<KToggleAction>(QStringLiteral("show_hidden_files"));
showHiddenFiles->setText(i18nc("@action:inmenu View", "Hidden Files"));
showHiddenFiles->setToolTip(i18nc("@info", "Visibility of hidden files and folders"));
m_actionCollection->setDefaultShortcuts(showHiddenFiles, {Qt::ALT + Qt::Key_Period, Qt::Key_F8});
connect(showHiddenFiles, &KToggleAction::triggered, this, &DolphinViewActionHandler::toggleShowHiddenFiles);
- QAction* adjustViewProps = m_actionCollection->addAction("view_properties");
+ QAction* adjustViewProps = m_actionCollection->addAction(QStringLiteral("view_properties"));
adjustViewProps->setText(i18nc("@action:inmenu View", "Adjust View Properties..."));
connect(adjustViewProps, &QAction::triggered, this, &DolphinViewActionHandler::slotAdjustViewProperties);
}
const DolphinView::Mode mode = action->data().value<DolphinView::Mode>();
m_currentView->setMode(mode);
- QAction* viewModeMenu = m_actionCollection->action("view_mode");
+ QAction* viewModeMenu = m_actionCollection->action(QStringLiteral("view_mode"));
viewModeMenu->setIcon(action->icon());
}
{
switch (m_currentView->mode()) {
case DolphinView::IconsView:
- return "icons";
+ return QStringLiteral("icons");
case DolphinView::DetailsView:
- return "details";
+ return QStringLiteral("details");
case DolphinView::CompactView:
- return "compact";
+ return QStringLiteral("compact");
default:
Q_ASSERT(false);
break;
if (viewModeAction) {
viewModeAction->setChecked(true);
- QAction* viewModeMenu = m_actionCollection->action("view_mode");
+ QAction* viewModeMenu = m_actionCollection->action(QStringLiteral("view_mode"));
viewModeMenu->setIcon(viewModeAction->icon());
}
- QAction* showPreviewAction = m_actionCollection->action("show_preview");
+ QAction* showPreviewAction = m_actionCollection->action(QStringLiteral("show_preview"));
showPreviewAction->setChecked(m_currentView->previewsShown());
slotSortOrderChanged(m_currentView->sortOrder());
void DolphinViewActionHandler::slotSortOrderChanged(Qt::SortOrder order)
{
- QAction* descending = m_actionCollection->action("descending");
+ QAction* descending = m_actionCollection->action(QStringLiteral("descending"));
const bool sortDescending = (order == Qt::DescendingOrder);
descending->setChecked(sortDescending);
}
void DolphinViewActionHandler::slotSortFoldersFirstChanged(bool foldersFirst)
{
- m_actionCollection->action("folders_first")->setChecked(foldersFirst);
+ m_actionCollection->action(QStringLiteral("folders_first"))->setChecked(foldersFirst);
}
void DolphinViewActionHandler::toggleVisibleRole(QAction* action)
void DolphinViewActionHandler::slotGroupedSortingChanged(bool groupedSorting)
{
- QAction* showInGroupsAction = m_actionCollection->action("show_in_groups");
+ QAction* showInGroupsAction = m_actionCollection->action(QStringLiteral("show_in_groups"));
showInGroupsAction->setChecked(groupedSorting);
}
void DolphinViewActionHandler::slotHiddenFilesShownChanged(bool shown)
{
- QAction* showHiddenFilesAction = m_actionCollection->action("show_hidden_files");
+ QAction* showHiddenFilesAction = m_actionCollection->action(QStringLiteral("show_hidden_files"));
showHiddenFilesAction->setChecked(shown);
- showHiddenFilesAction->setIcon(QIcon::fromTheme(shown ? "visibility" : "hint"));
+ showHiddenFilesAction->setIcon(QIcon::fromTheme(shown ? QStringLiteral("visibility") : QStringLiteral("hint")));
}
void DolphinViewActionHandler::slotWriteStateChanged(bool isFolderWritable)
{
- m_actionCollection->action("create_dir")->setEnabled(isFolderWritable);
+ m_actionCollection->action(QStringLiteral("create_dir"))->setEnabled(isFolderWritable);
}
KToggleAction* DolphinViewActionHandler::iconsModeAction()
{
- KToggleAction* iconsView = m_actionCollection->add<KToggleAction>("icons");
+ KToggleAction* iconsView = m_actionCollection->add<KToggleAction>(QStringLiteral("icons"));
iconsView->setText(i18nc("@action:inmenu View Mode", "Icons"));
iconsView->setToolTip(i18nc("@info", "Icons view mode"));
m_actionCollection->setDefaultShortcut(iconsView, Qt::CTRL | Qt::Key_1);
- iconsView->setIcon(QIcon::fromTheme("view-list-icons"));
+ iconsView->setIcon(QIcon::fromTheme(QStringLiteral("view-list-icons")));
iconsView->setData(QVariant::fromValue(DolphinView::IconsView));
return iconsView;
}
KToggleAction* DolphinViewActionHandler::compactModeAction()
{
- KToggleAction* iconsView = m_actionCollection->add<KToggleAction>("compact");
+ KToggleAction* iconsView = m_actionCollection->add<KToggleAction>(QStringLiteral("compact"));
iconsView->setText(i18nc("@action:inmenu View Mode", "Compact"));
iconsView->setToolTip(i18nc("@info", "Compact view mode"));
m_actionCollection->setDefaultShortcut(iconsView, Qt::CTRL | Qt::Key_2);
- iconsView->setIcon(QIcon::fromTheme("view-list-details")); // TODO: discuss with Oxygen-team the wrong (?) name
+ iconsView->setIcon(QIcon::fromTheme(QStringLiteral("view-list-details"))); // TODO: discuss with Oxygen-team the wrong (?) name
iconsView->setData(QVariant::fromValue(DolphinView::CompactView));
return iconsView;
}
KToggleAction* DolphinViewActionHandler::detailsModeAction()
{
- KToggleAction* detailsView = m_actionCollection->add<KToggleAction>("details");
+ KToggleAction* detailsView = m_actionCollection->add<KToggleAction>(QStringLiteral("details"));
detailsView->setText(i18nc("@action:inmenu View Mode", "Details"));
detailsView->setToolTip(i18nc("@info", "Details view mode"));
m_actionCollection->setDefaultShortcut(detailsView, Qt::CTRL | Qt::Key_3);
- detailsView->setIcon(QIcon::fromTheme("view-list-tree"));
+ detailsView->setIcon(QIcon::fromTheme(QStringLiteral("view-list-tree")));
detailsView->setData(QVariant::fromValue(DolphinView::DetailsView));
return detailsView;
}
action->setChecked(true);
if (!action->icon().isNull()) {
- QAction* sortByMenu = m_actionCollection->action("sort");
+ QAction* sortByMenu = m_actionCollection->action(QStringLiteral("sort"));
sortByMenu->setIcon(action->icon());
}
}
// action-group that assures an exclusive toggle-state between the main-menu
// actions and the sub-menu-actions. If an action gets checked, it must
// be assured that all other actions get unchecked.
- QAction* sortByMenu = m_actionCollection->action("sort");
+ QAction* sortByMenu = m_actionCollection->action(QStringLiteral("sort"));
foreach (QAction* groupAction, sortByMenu->menu()->actions()) {
KActionMenu* actionMenu = qobject_cast<KActionMenu*>(groupAction);
if (actionMenu) {
KIO::DropJob* DragAndDropHelper::dropUrls(const QUrl& destUrl, QDropEvent* event, QWidget* window)
{
const QMimeData* mimeData = event->mimeData();
- if (mimeData->hasFormat("application/x-kde-ark-dndextract-service") &&
- mimeData->hasFormat("application/x-kde-ark-dndextract-path")) {
- const QString remoteDBusClient = mimeData->data("application/x-kde-ark-dndextract-service");
- const QString remoteDBusPath = mimeData->data("application/x-kde-ark-dndextract-path");
+ if (mimeData->hasFormat(QStringLiteral("application/x-kde-ark-dndextract-service")) &&
+ mimeData->hasFormat(QStringLiteral("application/x-kde-ark-dndextract-path"))) {
+ const QString remoteDBusClient = mimeData->data(QStringLiteral("application/x-kde-ark-dndextract-service"));
+ const QString remoteDBusPath = mimeData->data(QStringLiteral("application/x-kde-ark-dndextract-path"));
QDBusMessage message = QDBusMessage::createMethodCall(remoteDBusClient, remoteDBusPath,
- "org.kde.ark.DndExtract", "extractSelectedFilesTo");
+ QStringLiteral("org.kde.ark.DndExtract"), QStringLiteral("extractSelectedFilesTo"));
message.setArguments({destUrl.toDisplayString(QUrl::PreferLocalFile)});
QDBusConnection::sessionBus().call(message);
} else {
m_okButton = buttonBox->button(QDialogButtonBox::Ok);
m_okButton->setDefault(true);
m_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, &RenameDialog::slotAccepted);
+ connect(buttonBox, &QDialogButtonBox::rejected, this, &RenameDialog::reject);
m_okButton->setDefault(true);
- KGuiItem::assign(m_okButton, KGuiItem(i18nc("@action:button", "&Rename"), "dialog-ok-apply"));
+ KGuiItem::assign(m_okButton, KGuiItem(i18nc("@action:button", "&Rename"), QStringLiteral("dialog-ok-apply")));
QWidget* page = new QWidget(this);
mainLayout->addWidget(page);
QTextLine line = textLayout.createLine();
while (line.isValid()) {
line.setLineWidth(m_name->maximumWidth());
- wrappedText += processedName.mid(line.textStart(), line.textLength());
+ wrappedText += processedName.midRef(line.textStart(), line.textLength());
line = textLayout.createLine();
if (line.isValid()) {
// all fileview version control plugins and remember them in 'plugins'.
const QStringList enabledPlugins = VersionControlSettings::enabledPlugins();
- const KService::List pluginServices = KServiceTypeTrader::self()->query("FileViewVersionControlPlugin");
+ const KService::List pluginServices = KServiceTypeTrader::self()->query(QStringLiteral("FileViewVersionControlPlugin"));
for (KService::List::ConstIterator it = pluginServices.constBegin(); it != pluginServices.constEnd(); ++it) {
if (enabledPlugins.contains((*it)->name())) {
KVersionControlPlugin* plugin = (*it)->createInstance<KVersionControlPlugin>();
// If the directory is not writable by the user or the directory is not local,
// we store the properties information in a local file.
if (useGlobalViewProps) {
- m_filePath = destinationDir("global");
- } else if (url.scheme().contains("search")) {
- m_filePath = destinationDir("search/") + directoryHashForUrl(url);
+ m_filePath = destinationDir(QStringLiteral("global"));
+ } else if (url.scheme().contains(QStringLiteral("search"))) {
+ m_filePath = destinationDir(QStringLiteral("search/")) + directoryHashForUrl(url);
useDetailsViewWithPath = true;
} else if (url.scheme() == QLatin1String("trash")) {
- m_filePath = destinationDir("trash");
+ m_filePath = destinationDir(QStringLiteral("trash"));
useDetailsViewWithPath = true;
} else if (url.isLocalFile()) {
m_filePath = url.toLocalFile();
// m_filePath probably begins with C:/ - the colon is not a valid character for paths though
m_filePath = QDir::separator() + m_filePath.remove(QLatin1Char(':'));
#endif
- m_filePath = destinationDir("local") + m_filePath;
+ m_filePath = destinationDir(QStringLiteral("local")) + m_filePath;
}
} else {
- m_filePath = destinationDir("remote") + m_filePath;
+ m_filePath = destinationDir(QStringLiteral("remote")) + m_filePath;
}
const QString file = m_filePath + QDir::separator() + ViewPropertiesFileName;
}
// Add the updated values for the current view-mode
+ newVisibleRoles.reserve(roles.count());
foreach (const QByteArray& role, roles) {
newVisibleRoles.append(prefix + role);
}
QString prefix;
switch (m_node->viewMode()) {
- case DolphinView::IconsView: prefix = "Icons_"; break;
- case DolphinView::CompactView: prefix = "Compact_"; break;
- case DolphinView::DetailsView: prefix = "Details_"; break;
+ case DolphinView::IconsView: prefix = QStringLiteral("Icons_"); break;
+ case DolphinView::CompactView: prefix = QStringLiteral("Compact_"); break;
+ case DolphinView::DetailsView: prefix = QStringLiteral("Details_"); break;
default: qCWarning(DolphinDebug) << "Unknown view-mode of the view properties";
}
if (index >= 0 && index + 1 < visibleRole.length()) {
++index;
if (visibleRole[index] == QLatin1Char('L')) {
- visibleRole.replace("LinkDestination", "destination");
+ visibleRole.replace(QLatin1String("LinkDestination"), QLatin1String("destination"));
} else {
visibleRole[index] = visibleRole[index].toLower();
}
QString sortRole = m_node->sortRole();
if (sortRole == QLatin1String("name")) {
- sortRole = QLatin1String("text");
+ sortRole = QStringLiteral("text");
}
m_node->setVisibleRoles(visibleRoles);