#include "dolphinmainwindow.h"
+#include "dolphinmainwindowadaptor.h"
#include "config-terminal.h"
#include "global.h"
#include "dolphinbookmarkhandler.h"
#include <KActionMenu>
#include <KAuthorized>
#include <KConfig>
+#include <KConfigGui>
#include <KDualAction>
#include <KFileItemListProperties>
#include <KHelpMenu>
+#include <KIO/CommandLauncherJob>
#include <KIO/JobUiDelegate>
#include <KIO/OpenFileManagerWindowJob>
#include <KJobWidgets>
m_forwardAction(nullptr)
{
Q_INIT_RESOURCE(dolphin);
+
+ new MainWindowAdaptor(this);
+
#ifndef Q_OS_WIN
setWindowFlags(Qt::WindowContextHelpButtonHint);
#endif
}
}
+ if (GeneralSettings::rememberOpenedTabs()) {
+ KConfigGui::setSessionConfig(QStringLiteral("dolphin"), QStringLiteral("dolphin"));
+ KConfig *config = KConfigGui::sessionConfig();
+ saveGlobalProperties(config);
+ savePropertiesInternal(config, 1);
+ config->sync();
+ }
+
GeneralSettings::setVersion(CurrentDolphinVersion);
GeneralSettings::self()->save();
{
m_newFileMenu->setViewShowsHiddenFiles(activeViewContainer()->view()->hiddenFilesShown());
m_newFileMenu->checkUpToDate();
- m_newFileMenu->setPopupFiles(activeViewContainer()->url());
+ m_newFileMenu->setPopupFiles(QList<QUrl>() << activeViewContainer()->url());
}
void DolphinMainWindow::createDirectory()
{
m_newFileMenu->setViewShowsHiddenFiles(activeViewContainer()->view()->hiddenFilesShown());
- m_newFileMenu->setPopupFiles(activeViewContainer()->url());
+ m_newFileMenu->setPopupFiles(QList<QUrl>() << activeViewContainer()->url());
m_newFileMenu->createDirectory();
}
void DolphinMainWindow::copy()
{
- m_activeViewContainer->view()->copySelectedItems();
+ m_activeViewContainer->view()->copySelectedItemsToClipboard();
}
void DolphinMainWindow::paste()
command.append("\" \"");
command.append(urlB.toDisplayString(QUrl::PreferLocalFile));
command.append('\"');
- KRun::runCommand(command, QStringLiteral("Kompare"), QStringLiteral("kompare"), this);
+
+ KIO::CommandLauncherJob *job = new KIO::CommandLauncherJob(command, this);
+ job->setDesktopName(QStringLiteral("org.kde.kompare"));
+ job->start();
}
void DolphinMainWindow::toggleShowMenuBar()
{
m_searchTools.clear();
KMoreToolsMenuFactory("dolphin/search-tools").fillMenuFromGroupingNames(
- &m_searchTools, { "files-find" }, QUrl::fromLocalFile(activeContainerLocalPath())
+ &m_searchTools, { "files-find" }, m_activeViewContainer->url()
);
QList<QAction*> actions = m_searchTools.actions();
if (actions.isEmpty()) {
void DolphinMainWindow::updateWindowTitle()
{
- const QString newTitle = m_activeViewContainer->caption();
+ const QString newTitle = m_activeViewContainer->captionWindowTitle();
if (windowTitle() != newTitle) {
setWindowTitle(newTitle);
}
QAction* addToPlaces = actionCollection()->addAction(QStringLiteral("add_to_places"));
addToPlaces->setIcon(QIcon::fromTheme(QStringLiteral("bookmark-new")));
+ addToPlaces->setText(i18nc("@action:inmenu Add current folder to places", "Add to Places"));
addToPlaces->setWhatsThis(xi18nc("@info:whatsthis", "This adds the selected folder "
"to the Places panel."));
connect(addToPlaces, &QAction::triggered, this, &DolphinMainWindow::addToPlaces);
openTerminal->setIcon(QIcon::fromTheme(QStringLiteral("dialog-scripts")));
actionCollection()->setDefaultShortcut(openTerminal, Qt::SHIFT + Qt::Key_F4);
connect(openTerminal, &QAction::triggered, this, &DolphinMainWindow::openTerminal);
+
+ QAction* focusTerminalPanel = actionCollection()->addAction(QStringLiteral("focus_terminal_panel"));
+ focusTerminalPanel->setText(i18nc("@action:inmenu Tools", "Focus Terminal Panel"));
+ focusTerminalPanel->setIcon(QIcon::fromTheme(QStringLiteral("swap-panels")));
+ actionCollection()->setDefaultShortcut(focusTerminalPanel, Qt::CTRL + Qt::SHIFT + Qt::Key_F4);
+ connect(focusTerminalPanel, &QAction::triggered, this, &DolphinMainWindow::focusTerminalPanel);
}
#endif
stateChanged(QStringLiteral("has_no_selection"));
addToPlacesAction->setEnabled(true);
- addToPlacesAction->setText(i18nc("@action:inmenu Add current folder to places", "Add '%1' to Places", m_activeViewContainer->placesText()));
} else {
stateChanged(QStringLiteral("has_selection"));
QAction* cutAction = col->action(KStandardAction::name(KStandardAction::Cut));
QAction* deleteWithTrashShortcut = col->action(QStringLiteral("delete_shortcut")); // see DolphinViewActionHandler
QAction* showTarget = col->action(QStringLiteral("show_target"));
+ QAction* duplicateAction = col->action(QStringLiteral("duplicate")); // see DolphinViewActionHandler
if (list.length() == 1 && list.first().isDir()) {
addToPlacesAction->setEnabled(true);
- addToPlacesAction->setText(i18nc("@action:inmenu Add current folder to places", "Add '%1' to Places", list.first().name()));
} else {
addToPlacesAction->setEnabled(false);
- addToPlacesAction->setText(i18nc("@action:inmenu Add current folder to places", "Add to Places"));
}
KFileItemListProperties capabilities(list);
deleteWithTrashShortcut->setEnabled(capabilities.supportsDeleting() && !enableMoveToTrash);
cutAction->setEnabled(capabilities.supportsMoving());
showTarget->setEnabled(list.length() == 1 && list.at(0).isLink());
+ duplicateAction->setEnabled(capabilities.supportsWriting());
}
}
QWhatsThisClickedEvent* whatsThisEvent = dynamic_cast<QWhatsThisClickedEvent*>(event);
QDesktopServices::openUrl(QUrl(whatsThisEvent->href()));
return true;
- } else if (event->type() == QEvent::WindowActivate) {
- updateOpenPreferredSearchToolAction();
}
return KXmlGuiWindow::event(event);
}
return false;
}
+void DolphinMainWindow::focusTerminalPanel()
+{
+ if (m_terminalPanel->isVisible()) {
+ if (m_terminalPanel->terminalHasFocus()) {
+ m_activeViewContainer->view()->setFocus(Qt::FocusReason::ShortcutFocusReason);
+ actionCollection()->action(QStringLiteral("focus_terminal_panel"))->setText(i18nc("@action:inmenu Tools", "Focus Terminal Panel"));
+ } else {
+ m_terminalPanel->setFocus(Qt::FocusReason::ShortcutFocusReason);
+ actionCollection()->action(QStringLiteral("focus_terminal_panel"))->setText(i18nc("@action:inmenu Tools", "Defocus Terminal Panel"));
+ }
+ } else {
+ actionCollection()->action(QStringLiteral("show_terminal_panel"))->trigger();
+ actionCollection()->action(QStringLiteral("focus_terminal_panel"))->setText(i18nc("@action:inmenu Tools", "Defocus Terminal Panel"));
+ }
+}
+
DolphinMainWindow::UndoUiInterface::UndoUiInterface() :
KIO::FileUndoManager::UiInterface()
{