#include <kdualaction.h>
#include <KDialog>
#include <KJobWidgets>
-#include <KLineEdit>
+#include <QLineEdit>
#include <KToolBar>
#include <KIO/NetAccess>
#include <KIO/JobUiDelegate>
emit selectionChanged(selection);
}
-void DolphinMainWindow::slotRequestItemInfo(const KFileItem& item)
-{
- emit requestItemInfo(item);
-}
-
void DolphinMainWindow::updateHistory()
{
const KUrlNavigator* urlNavigator = m_activeViewContainer->urlNavigator();
}
if (!newWindowUrl.isEmpty()) {
- KRun::run("dolphin %u", QList<QUrl>() << newWindowUrl, this);
+ KRun::run("dolphin %u", {newWindowUrl}, this);
}
}
const QUrl& url,
const QList<QAction*>& customActions)
{
- QWeakPointer<DolphinContextMenu> contextMenu = new DolphinContextMenu(this, pos, item, url);
+ QScopedPointer<DolphinContextMenu> contextMenu(new DolphinContextMenu(this, pos, item, url));
contextMenu.data()->setCustomActions(customActions);
const DolphinContextMenu::Command command = contextMenu.data()->open();
case DolphinContextMenu::OpenParentFolderInNewWindow: {
- KRun::run("dolphin %u", QList<QUrl>() << KIO::upUrl(item.url()), this);
+ KRun::run("dolphin %u", {KIO::upUrl(item.url())}, this);
break;
}
default:
break;
}
-
- delete contextMenu.data();
}
void DolphinMainWindow::updateControlMenu()
m_updateToolBarTimer->start();
}
-void DolphinMainWindow::slotPanelErrorMessage(const QString& error)
-{
- activeViewContainer()->showMessage(error, DolphinViewContainer::Error);
-}
-
void DolphinMainWindow::slotPlaceActivated(const QUrl& url)
{
DolphinViewContainer* view = activeViewContainer();
}
}
- const QString fileName = url.fileName().isEmpty() ? "/" : url.fileName();
+ QString fileName = url.adjusted(QUrl::StripTrailingSlash).fileName();
+ if (fileName.isEmpty()) {
+ fileName = '/';
+ }
+
caption.append(fileName);
setCaption(caption);
QAction* newTab = actionCollection()->addAction("new_tab");
newTab->setIcon(QIcon::fromTheme("tab-new"));
newTab->setText(i18nc("@action:inmenu File", "New Tab"));
- actionCollection()->setDefaultShortcuts(newTab, QList<QKeySequence>() << QKeySequence(Qt::CTRL | Qt::Key_T) << QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_N));
+ 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");
undoCloseTab->setEnabled(false);
connect(undoCloseTab, SIGNAL(triggered()), recentTabsMenu, SLOT(undoCloseTab()));
+ auto undoAction = actionCollection()->action(KStandardAction::name(KStandardAction::Undo));
+ undoAction->setEnabled(false); // undo should be disabled by default
+
KStandardAction::forward(this, SLOT(goForward()), actionCollection());
KStandardAction::up(this, SLOT(goUp()), actionCollection());
KStandardAction::home(this, SLOT(goHome()), actionCollection());
KStandardAction::preferences(this, SLOT(editSettings()), actionCollection());
// not in menu actions
- QList<QKeySequence> nextTabKeys;
- nextTabKeys.append(KStandardShortcut::tabNext().first()); //TODO: is this correct
+ QList<QKeySequence> nextTabKeys = KStandardShortcut::tabNext();
nextTabKeys.append(QKeySequence(Qt::CTRL | Qt::Key_Tab));
- QList<QKeySequence> prevTabKeys;
- prevTabKeys.append(KStandardShortcut::tabPrev().first()); //TODO: is this correct
+ QList<QKeySequence> prevTabKeys = KStandardShortcut::tabPrev();
prevTabKeys.append(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_Tab));
QAction* activateNextTab = actionCollection()->addAction("activate_next_tab");
infoDock->setObjectName("infoDock");
infoDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
InformationPanel* infoPanel = new InformationPanel(infoDock);
- infoPanel->setCustomContextMenuActions(QList<QAction*>() << lockLayoutAction);
+ infoPanel->setCustomContextMenuActions({lockLayoutAction});
connect(infoPanel, &InformationPanel::urlActivated, this, &DolphinMainWindow::handleUrl);
infoDock->setWidget(infoPanel);
foldersDock->setObjectName("foldersDock");
foldersDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
FoldersPanel* foldersPanel = new FoldersPanel(foldersDock);
- foldersPanel->setCustomContextMenuActions(QList<QAction*>() << lockLayoutAction);
+ foldersPanel->setCustomContextMenuActions({lockLayoutAction});
foldersDock->setWidget(foldersPanel);
QAction* foldersAction = foldersDock->toggleViewAction();
connect(foldersPanel, &FoldersPanel::folderMiddleClicked,
this, &DolphinMainWindow::openNewTab);
connect(foldersPanel, &FoldersPanel::errorMessage,
- this, &DolphinMainWindow::slotPanelErrorMessage);
+ this, &DolphinMainWindow::showErrorMessage);
// Setup "Terminal"
#ifndef Q_OS_WIN
terminalDock->setObjectName("terminalDock");
terminalDock->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea);
TerminalPanel* terminalPanel = new TerminalPanel(terminalDock);
- terminalPanel->setCustomContextMenuActions(QList<QAction*>() << lockLayoutAction);
+ terminalPanel->setCustomContextMenuActions({lockLayoutAction});
terminalDock->setWidget(terminalPanel);
connect(terminalPanel, &TerminalPanel::hideTerminalPanel, terminalDock, &DolphinDockWidget::hide);
placesDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
PlacesPanel* placesPanel = new PlacesPanel(placesDock);
- placesPanel->setCustomContextMenuActions(QList<QAction*>() << lockLayoutAction);
+ placesPanel->setCustomContextMenuActions({lockLayoutAction});
placesDock->setWidget(placesPanel);
QAction* placesAction = placesDock->toggleViewAction();
connect(placesPanel, SIGNAL(placeMiddleClicked(QUrl)),
this, SLOT(openNewTab(QUrl)));
connect(placesPanel, &PlacesPanel::errorMessage,
- this, &DolphinMainWindow::slotPanelErrorMessage);
+ this, &DolphinMainWindow::showErrorMessage);
connect(this, &DolphinMainWindow::urlChanged,
placesPanel, &PlacesPanel::setUrl);
connect(placesDock, &DolphinDockWidget::visibilityChanged,
connect(view, &DolphinView::selectionChanged,
this, &DolphinMainWindow::slotSelectionChanged);
connect(view, &DolphinView::requestItemInfo,
- this, &DolphinMainWindow::slotRequestItemInfo);
+ this, &DolphinMainWindow::requestItemInfo);
connect(view, &DolphinView::tabRequested,
this, &DolphinMainWindow::openNewTab);
connect(view, &DolphinView::requestContextMenu,