2020-08-25 17:07:38 +00:00
/*
* SPDX - FileCopyrightText : 2006 Peter Penz < peter . penz19 @ gmail . com >
* SPDX - FileCopyrightText : 2006 Stefan Monov < logixoul @ gmail . com >
* SPDX - FileCopyrightText : 2006 Cvetoslav Ludmiloff < ludmiloff @ gmail . com >
*
* SPDX - License - Identifier : GPL - 2.0 - or - later
*/
2007-04-01 18:36:23 +00:00
# include "dolphinmainwindow.h"
2019-12-23 10:06:54 +00:00
# include "dolphinmainwindowadaptor.h"
2015-10-10 13:09:48 +00:00
# include "global.h"
Add Bookmark Handling
Summary:
Add Bookmark Handling. Adds complete bookmark support as provided by
other KDE applications like Konsole and Konqueror. This allows you to
bookmark individual folders, create bookmark folders and open them.
Test Plan:
Go -> Bookmark -> Add Bookmark
Go -> Bookmark -> [Open the bookmark you selected]
FEATURE: 171366
Reviewers: #dolphin, elvisangelaccio, ngraham
Reviewed By: #dolphin, elvisangelaccio, ngraham
Subscribers: ognarb, meven, loh.tar, cfeck, hein, kfm-devel
Tags: #dolphin
Maniphest Tasks: T5408
Differential Revision: https://phabricator.kde.org/D19926
2019-03-20 19:29:20 +00:00
# include "dolphinbookmarkhandler.h"
2010-12-31 10:59:46 +00:00
# include "dolphindockwidget.h"
2010-01-25 07:58:24 +00:00
# include "dolphincontextmenu.h"
2020-11-05 22:30:07 +00:00
# include "dolphinnavigatorswidgetaction.h"
2010-08-27 05:26:27 +00:00
# include "dolphinnewfilemenu.h"
2014-06-19 20:04:36 +00:00
# include "dolphinrecenttabsmenu.h"
2021-12-16 18:29:22 +00:00
# include "dolphinplacesmodelsingleton.h"
2020-11-05 22:30:07 +00:00
# include "dolphinurlnavigatorscontroller.h"
2007-06-07 21:10:48 +00:00
# include "dolphinviewcontainer.h"
2014-07-02 13:30:37 +00:00
# include "dolphintabpage.h"
2017-08-24 13:45:28 +00:00
# include "middleclickactioneventfilter.h"
2009-01-14 20:14:36 +00:00
# include "panels/folders/folderspanel.h"
# include "panels/places/placespanel.h"
2018-01-21 11:18:21 +00:00
# include "panels/terminal/terminalpanel.h"
2022-04-24 11:18:30 +00:00
# include "selectionmode/actiontexthelper.h"
2010-07-24 22:08:30 +00:00
# include "settings/dolphinsettingsdialog.h"
2009-08-01 20:01:51 +00:00
# include "statusbar/dolphinstatusbar.h"
2010-07-24 22:08:30 +00:00
# include "views/dolphinviewactionhandler.h"
# include "views/dolphinremoteencoding.h"
2012-01-27 20:52:29 +00:00
# include "views/draganddrophelper.h"
2010-07-24 22:08:30 +00:00
# include "views/viewproperties.h"
2013-08-28 16:46:45 +00:00
# include "views/dolphinnewfilemenuobserver.h"
2007-04-01 18:36:23 +00:00
# include "dolphin_generalsettings.h"
2011-02-04 14:43:21 +00:00
# include <KActionCollection>
# include <KActionMenu>
2016-05-18 01:06:49 +00:00
# include <KAuthorized>
2011-02-04 14:43:21 +00:00
# include <KConfig>
Add an option to show tabs from last time when Dolphin starts
Summary:
All modern web browsers offer a function to show tabs from last time when a browser starts, and many apps today
restore their prior state when they're launched. This patch implements thatfunctionality as an option and turns it on by default.
The settings window is accordingly adjusted to be clear about what applies when:
{F7681752}
FEATURE: 413564
FIXED-IN: 20.08.0
Depends on D25106
Depends on D25219
Test Plan:
With the new setting turned off:
- No behavioral changes at all
With the new setting turned on:
- When launched from the GUI or CLI without any URLs, dolphin restores session
- When rebooting with Dolphin open, it restores session normally after the system comes back (i.e. no behavioral change here)
- When launched with URLs, Dolphin window is opened showing those URLs instead of restoring session
- When Dolphin is already running and a new window is opened, that new window shows a single tab with the same URL as was visible in the previously-open Dolphin instance (i.e. no behavioral change here)
- "Open Containing folder" functionality in other apps works regardless of whether or not Dolphin is running
Reviewers: #dolphin, #vdg, feverfew, meven, elvisangelaccio, ndavis
Reviewed By: #dolphin, #vdg, feverfew, elvisangelaccio, ndavis
Subscribers: davidedmundson, ndavis, intika, feverfew, kfm-devel, ngraham, broulik, #dolphin
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D11382
2019-07-19 17:52:12 +00:00
# include <KConfigGui>
2019-01-15 17:11:09 +00:00
# include <KDualAction>
2018-03-04 13:38:16 +00:00
# include <KFileItemListProperties>
2020-04-05 11:44:12 +00:00
# include <KIO/CommandLauncherJob>
2022-10-11 06:46:12 +00:00
# include <kio_version.h>
# if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0)
# include <KIO/JobUiDelegateFactory>
# else
2012-04-17 20:19:18 +00:00
# include <KIO/JobUiDelegate>
2022-10-11 06:46:12 +00:00
# endif
2018-03-03 13:36:44 +00:00
# include <KIO/OpenFileManagerWindowJob>
2020-08-18 08:43:58 +00:00
# include <KIO/OpenUrlJob>
2018-03-04 13:38:16 +00:00
# include <KJobWidgets>
2014-10-18 12:42:41 +00:00
# include <KLocalizedString>
2011-02-04 14:43:21 +00:00
# include <KMessageBox>
2022-05-08 07:54:30 +00:00
# include <KMoreToolsMenuFactory>
2018-03-04 13:38:16 +00:00
# include <KProtocolInfo>
# include <KProtocolManager>
2011-02-04 14:43:21 +00:00
# include <KShell>
2022-01-25 17:33:01 +00:00
# include <KShortcutsDialog>
2011-02-04 14:43:21 +00:00
# include <KStandardAction>
Open externally called files/directories in new tabs
Summary:
FEATURE: 183429
FIXED-IN: 19.08.0
GUI: new cli argument --new-window
Externally called files/directories are opened in a a new tab of an instance of Dolphin that already exists. If any of the given URIs are already open in a tab, then those tabs are activated instead of a new tab being opened. If there is no instance then the files/directories are opened in a new window. The newly opened file/directory has its tab activated, and consequently, the window is also activated.
When the user clicks "Open In New Window" or "Detach Tab", the files/directories are opened in a new window.
Test Plan:
[Manual]
Before testing, set the default file manager in system settings as the newly built Dolphin executable.
One must also include the new dolphin executable in the $PATH, otherwise some functions will attempt to open the system dolphin instead of the new one.
Furthermore, running two different versions of Dolphin (in particular, where one does not have this patch included) can result in bugs appearing, in particular, new tabs not opening as old instances will not recognise the DBus commands sent to it. However, I see no reason why a user will have two different versions of Dolphin (apart from people like us :D).
Open directories with the help of auxillary programs (i.e. a browser). The files/directories should appear in a new window if an instance does not exist. If an existence already exists, then a new tab should be opened and activated in that instance and the window activated.
Use QDBusViewer to open folders/items by calling the ShowFolders/ShowItems methods in org.freedesktop.FileManager1 of the Dolphin instance.
When a user chooses to "Open In New Window"/"Detach Tab" then the files/directories should be opened in a new window.
Reviewers: #dolphin, elvisangelaccio
Subscribers: zzag, dfaure, fvogt, fikrim, magar, fbg13, davidedmundson, kwin, ngraham, elvisangelaccio, anthonyfieroni, kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D16648
2019-05-30 20:22:43 +00:00
# include <KStartupInfo>
2020-05-24 14:25:14 +00:00
# include <KSycoca>
2021-08-31 15:09:14 +00:00
# include <KTerminalLauncherJob>
2011-02-04 14:43:21 +00:00
# include <KToggleAction>
2018-03-04 13:38:16 +00:00
# include <KToolBar>
Add navigation history to forward/back buttons
Summary:
Adds navigation history to forward/back buttons in the toolbar. This
changes the forward/back buttons in the toolbar to use the
KToolBarPopupAction class which provides access to a drop down menu.
Test Plan:
Browse some folders
Click the back drop down menu and navigate somewhere
Click the forward drop down menu and navigate somewhere
FEATURE: 157819
FIXED-IN: 19.12.0
Reviewers: #dolphin, ngraham, elvisangelaccio, #vdg
Reviewed By: #dolphin, ngraham, elvisangelaccio, #vdg
Subscribers: felixernst, nerdopolist, mart, richardl, ognarb, david.fontanals, abetts, kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D19311
2019-04-11 17:21:41 +00:00
# include <KToolBarPopupAction>
2014-10-18 13:00:17 +00:00
# include <KUrlComboBox>
2018-03-04 13:38:16 +00:00
# include <KUrlNavigator>
Open externally called files/directories in new tabs
Summary:
FEATURE: 183429
FIXED-IN: 19.08.0
GUI: new cli argument --new-window
Externally called files/directories are opened in a a new tab of an instance of Dolphin that already exists. If any of the given URIs are already open in a tab, then those tabs are activated instead of a new tab being opened. If there is no instance then the files/directories are opened in a new window. The newly opened file/directory has its tab activated, and consequently, the window is also activated.
When the user clicks "Open In New Window" or "Detach Tab", the files/directories are opened in a new window.
Test Plan:
[Manual]
Before testing, set the default file manager in system settings as the newly built Dolphin executable.
One must also include the new dolphin executable in the $PATH, otherwise some functions will attempt to open the system dolphin instead of the new one.
Furthermore, running two different versions of Dolphin (in particular, where one does not have this patch included) can result in bugs appearing, in particular, new tabs not opening as old instances will not recognise the DBus commands sent to it. However, I see no reason why a user will have two different versions of Dolphin (apart from people like us :D).
Open directories with the help of auxillary programs (i.e. a browser). The files/directories should appear in a new window if an instance does not exist. If an existence already exists, then a new tab should be opened and activated in that instance and the window activated.
Use QDBusViewer to open folders/items by calling the ShowFolders/ShowItems methods in org.freedesktop.FileManager1 of the Dolphin instance.
When a user chooses to "Open In New Window"/"Detach Tab" then the files/directories should be opened in a new window.
Reviewers: #dolphin, elvisangelaccio
Subscribers: zzag, dfaure, fvogt, fikrim, magar, fbg13, davidedmundson, kwin, ngraham, elvisangelaccio, anthonyfieroni, kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D16648
2019-05-30 20:22:43 +00:00
# include <KWindowSystem>
2021-04-29 13:22:10 +00:00
# include <KXMLGUIFactory>
2007-04-01 18:36:23 +00:00
2022-09-30 17:56:52 +00:00
# include <kwidgetsaddons_version.h>
2021-04-18 06:37:45 +00:00
# include <kio_version.h>
2015-02-04 09:22:03 +00:00
# include <QApplication>
2007-12-16 19:25:59 +00:00
# include <QClipboard>
2014-10-18 13:00:17 +00:00
# include <QCloseEvent>
2019-06-23 19:19:49 +00:00
# include <QDesktopServices>
2015-02-03 08:25:33 +00:00
# include <QDialog>
2021-04-29 13:22:10 +00:00
# include <QDomDocument>
2018-03-03 13:36:44 +00:00
# include <QFileInfo>
2018-03-04 13:38:16 +00:00
# include <QLineEdit>
# include <QMenuBar>
# include <QPushButton>
# include <QShowEvent>
# include <QStandardPaths>
# include <QTimer>
# include <QToolButton>
2007-04-01 18:36:23 +00:00
2011-08-13 10:42:53 +00:00
namespace {
// Used for GeneralSettings::version() to determine whether
2022-05-05 18:31:30 +00:00
// an updated version of Dolphin is running, so as to migrate
// removed/renamed ...etc config entries; increment it in such
// cases
const int CurrentDolphinVersion = 202 ;
Add navigation history to forward/back buttons
Summary:
Adds navigation history to forward/back buttons in the toolbar. This
changes the forward/back buttons in the toolbar to use the
KToolBarPopupAction class which provides access to a drop down menu.
Test Plan:
Browse some folders
Click the back drop down menu and navigate somewhere
Click the forward drop down menu and navigate somewhere
FEATURE: 157819
FIXED-IN: 19.12.0
Reviewers: #dolphin, ngraham, elvisangelaccio, #vdg
Reviewed By: #dolphin, ngraham, elvisangelaccio, #vdg
Subscribers: felixernst, nerdopolist, mart, richardl, ognarb, david.fontanals, abetts, kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D19311
2019-04-11 17:21:41 +00:00
// The maximum number of entries in the back/forward popup menu
const int MaxNumberOfNavigationentries = 12 ;
2019-10-13 14:37:00 +00:00
// The maximum number of "Activate Tab" shortcuts
const int MaxActivateTabShortcuts = 9 ;
2016-06-25 14:39:49 +00:00
}
2011-08-13 10:42:53 +00:00
2011-04-12 18:01:31 +00:00
DolphinMainWindow : : DolphinMainWindow ( ) :
2019-10-01 21:48:41 +00:00
KXmlGuiWindow ( nullptr ) ,
2017-11-21 09:52:14 +00:00
m_newFileMenu ( nullptr ) ,
m_tabWidget ( nullptr ) ,
m_activeViewContainer ( nullptr ) ,
m_actionHandler ( nullptr ) ,
m_remoteEncoding ( nullptr ) ,
2011-04-12 18:01:31 +00:00
m_settingsDialog ( ) ,
Add Bookmark Handling
Summary:
Add Bookmark Handling. Adds complete bookmark support as provided by
other KDE applications like Konsole and Konqueror. This allows you to
bookmark individual folders, create bookmark folders and open them.
Test Plan:
Go -> Bookmark -> Add Bookmark
Go -> Bookmark -> [Open the bookmark you selected]
FEATURE: 171366
Reviewers: #dolphin, elvisangelaccio, ngraham
Reviewed By: #dolphin, elvisangelaccio, ngraham
Subscribers: ognarb, meven, loh.tar, cfeck, hein, kfm-devel
Tags: #dolphin
Maniphest Tasks: T5408
Differential Revision: https://phabricator.kde.org/D19926
2019-03-20 19:29:20 +00:00
m_bookmarkHandler ( nullptr ) ,
2020-08-18 08:43:58 +00:00
m_lastHandleUrlOpenJob ( nullptr ) ,
2017-11-21 09:52:14 +00:00
m_terminalPanel ( nullptr ) ,
m_placesPanel ( nullptr ) ,
Add navigation history to forward/back buttons
Summary:
Adds navigation history to forward/back buttons in the toolbar. This
changes the forward/back buttons in the toolbar to use the
KToolBarPopupAction class which provides access to a drop down menu.
Test Plan:
Browse some folders
Click the back drop down menu and navigate somewhere
Click the forward drop down menu and navigate somewhere
FEATURE: 157819
FIXED-IN: 19.12.0
Reviewers: #dolphin, ngraham, elvisangelaccio, #vdg
Reviewed By: #dolphin, ngraham, elvisangelaccio, #vdg
Subscribers: felixernst, nerdopolist, mart, richardl, ognarb, david.fontanals, abetts, kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D19311
2019-04-11 17:21:41 +00:00
m_tearDownFromPlacesRequested ( false ) ,
m_backAction ( nullptr ) ,
2020-11-05 22:30:07 +00:00
m_forwardAction ( nullptr )
2007-04-01 18:36:23 +00:00
{
2017-07-28 11:35:50 +00:00
Q_INIT_RESOURCE ( dolphin ) ;
2019-12-23 10:06:54 +00:00
new MainWindowAdaptor ( this ) ;
2019-10-01 21:48:41 +00:00
# ifndef Q_OS_WIN
setWindowFlags ( Qt : : WindowContextHelpButtonHint ) ;
# endif
2018-04-29 15:07:18 +00:00
setComponentName ( QStringLiteral ( " dolphin " ) , QGuiApplication : : applicationDisplayName ( ) ) ;
2016-03-16 21:17:37 +00:00
setObjectName ( QStringLiteral ( " Dolphin# " ) ) ;
2008-04-12 15:09:46 +00:00
2022-04-25 10:52:05 +00:00
setStateConfigGroup ( " State " ) ;
2021-09-30 05:31:58 +00:00
2014-04-10 14:53:41 +00:00
connect ( & DolphinNewFileMenuObserver : : instance ( ) , & DolphinNewFileMenuObserver : : errorMessage ,
this , & DolphinMainWindow : : showErrorMessage ) ;
2013-08-28 16:46:45 +00:00
2008-04-30 23:32:33 +00:00
KIO : : FileUndoManager * undoManager = KIO : : FileUndoManager : : self ( ) ;
2008-04-20 22:07:44 +00:00
undoManager - > setUiInterface ( new UndoUiInterface ( ) ) ;
2007-04-01 18:36:23 +00:00
2021-11-11 19:27:47 +00:00
connect ( undoManager , & KIO : : FileUndoManager : : undoAvailable ,
2014-04-10 14:53:41 +00:00
this , & DolphinMainWindow : : slotUndoAvailable ) ;
connect ( undoManager , & KIO : : FileUndoManager : : undoTextChanged ,
this , & DolphinMainWindow : : slotUndoTextChanged ) ;
connect ( undoManager , & KIO : : FileUndoManager : : jobRecordingStarted ,
this , & DolphinMainWindow : : clearStatusBar ) ;
connect ( undoManager , & KIO : : FileUndoManager : : jobRecordingFinished ,
this , & DolphinMainWindow : : showCommand ) ;
2011-04-12 18:01:31 +00:00
2020-12-11 19:05:15 +00:00
const bool firstRun = ( GeneralSettings : : version ( ) < 200 ) ;
2011-04-12 18:01:31 +00:00
if ( firstRun ) {
2020-12-11 19:05:15 +00:00
GeneralSettings : : setViewPropsTimestamp ( QDateTime : : currentDateTime ( ) ) ;
2011-04-12 18:01:31 +00:00
}
setAcceptDrops ( true ) ;
2020-09-20 16:53:59 +00:00
auto * navigatorsWidgetAction = new DolphinNavigatorsWidgetAction ( this ) ;
actionCollection ( ) - > addAction ( QStringLiteral ( " url_navigators " ) , navigatorsWidgetAction ) ;
m_tabWidget = new DolphinTabWidget ( navigatorsWidgetAction , this ) ;
2017-05-22 09:37:37 +00:00
m_tabWidget - > setObjectName ( " tabWidget " ) ;
2016-03-16 21:17:37 +00:00
connect ( m_tabWidget , & DolphinTabWidget : : activeViewChanged ,
this , & DolphinMainWindow : : activeViewChanged ) ;
connect ( m_tabWidget , & DolphinTabWidget : : tabCountChanged ,
this , & DolphinMainWindow : : tabCountChanged ) ;
connect ( m_tabWidget , & DolphinTabWidget : : currentUrlChanged ,
2018-07-28 15:29:00 +00:00
this , & DolphinMainWindow : : updateWindowTitle ) ;
2014-08-10 16:52:06 +00:00
setCentralWidget ( m_tabWidget ) ;
2022-04-24 11:18:30 +00:00
m_actionTextHelper = new SelectionMode : : ActionTextHelper ( this ) ;
2011-04-12 18:01:31 +00:00
setupActions ( ) ;
2022-04-24 11:18:30 +00:00
m_actionHandler = new DolphinViewActionHandler ( actionCollection ( ) , m_actionTextHelper , this ) ;
2014-04-10 14:53:41 +00:00
connect ( m_actionHandler , & DolphinViewActionHandler : : actionBeingHandled , this , & DolphinMainWindow : : clearStatusBar ) ;
2018-10-24 20:49:01 +00:00
connect ( m_actionHandler , & DolphinViewActionHandler : : createDirectoryTriggered , this , & DolphinMainWindow : : createDirectory ) ;
2022-04-28 20:55:28 +00:00
connect ( m_actionHandler , & DolphinViewActionHandler : : selectionModeChangeTriggered , this , & DolphinMainWindow : : slotSetSelectionMode ) ;
2011-04-12 18:01:31 +00:00
m_remoteEncoding = new DolphinRemoteEncoding ( this , m_actionHandler ) ;
2014-04-10 14:53:41 +00:00
connect ( this , & DolphinMainWindow : : urlChanged ,
m_remoteEncoding , & DolphinRemoteEncoding : : slotAboutToOpenUrl ) ;
2011-04-12 18:01:31 +00:00
setupDockWidgets ( ) ;
2022-01-25 17:33:01 +00:00
setupGUI ( Save | Create | ToolBar ) ;
2016-03-16 21:17:37 +00:00
stateChanged ( QStringLiteral ( " new_file " ) ) ;
2011-04-12 18:01:31 +00:00
QClipboard * clipboard = QApplication : : clipboard ( ) ;
2014-04-10 14:53:41 +00:00
connect ( clipboard , & QClipboard : : dataChanged ,
this , & DolphinMainWindow : : updatePasteAction ) ;
2011-04-12 18:01:31 +00:00
2020-12-02 07:07:41 +00:00
QAction * toggleFilterBarAction = actionCollection ( ) - > action ( QStringLiteral ( " toggle_filter " ) ) ;
2020-12-11 19:05:15 +00:00
toggleFilterBarAction - > setChecked ( GeneralSettings : : filterBar ( ) ) ;
2011-04-12 18:01:31 +00:00
if ( firstRun ) {
menuBar ( ) - > setVisible ( false ) ;
}
const bool showMenu = ! menuBar ( ) - > isHidden ( ) ;
QAction * showMenuBarAction = actionCollection ( ) - > action ( KStandardAction : : name ( KStandardAction : : ShowMenubar ) ) ;
showMenuBarAction - > setChecked ( showMenu ) ; // workaround for bug #171080
2021-04-29 13:22:10 +00:00
auto hamburgerMenu = static_cast < KHamburgerMenu * > ( actionCollection ( ) - > action (
KStandardAction : : name ( KStandardAction : : HamburgerMenu ) ) ) ;
hamburgerMenu - > setMenuBar ( menuBar ( ) ) ;
2021-05-13 16:49:27 +00:00
hamburgerMenu - > setShowMenuBarAction ( showMenuBarAction ) ;
2021-04-29 13:22:10 +00:00
connect ( hamburgerMenu , & KHamburgerMenu : : aboutToShowMenu ,
this , & DolphinMainWindow : : updateHamburgerMenu ) ;
hamburgerMenu - > hideActionsOf ( toolBar ( ) ) ;
if ( GeneralSettings : : version ( ) < 201 & & ! toolBar ( ) - > actions ( ) . contains ( hamburgerMenu ) ) {
addHamburgerMenuToToolbar ( ) ;
2011-04-12 18:01:31 +00:00
}
2017-08-24 13:45:28 +00:00
2020-11-19 21:22:27 +00:00
updateAllowedToolbarAreas ( ) ;
2017-08-24 13:45:28 +00:00
// enable middle-click on back/forward/up to open in a new tab
auto * middleClickEventFilter = new MiddleClickActionEventFilter ( this ) ;
connect ( middleClickEventFilter , & MiddleClickActionEventFilter : : actionMiddleClicked , this , & DolphinMainWindow : : slotToolBarActionMiddleClicked ) ;
toolBar ( ) - > installEventFilter ( middleClickEventFilter ) ;
2019-06-23 19:19:49 +00:00
setupWhatsThis ( ) ;
2019-11-17 17:14:27 +00:00
2021-11-11 19:27:47 +00:00
connect ( KSycoca : : self ( ) , & KSycoca : : databaseChanged , this , & DolphinMainWindow : : updateOpenPreferredSearchToolAction ) ;
2020-05-24 14:25:14 +00:00
QTimer : : singleShot ( 0 , this , & DolphinMainWindow : : updateOpenPreferredSearchToolAction ) ;
2021-04-18 06:37:45 +00:00
m_fileItemActions . setParentWidget ( this ) ;
connect ( & m_fileItemActions , & KFileItemActions : : error , this , [ this ] ( const QString & errorMessage ) {
showErrorMessage ( errorMessage ) ;
} ) ;
2021-09-28 19:39:52 +00:00
connect ( GeneralSettings : : self ( ) , & GeneralSettings : : splitViewChanged ,
this , & DolphinMainWindow : : slotSplitViewChanged ) ;
2007-04-01 18:36:23 +00:00
}
DolphinMainWindow : : ~ DolphinMainWindow ( )
{
2020-12-19 17:43:44 +00:00
// This fixes a crash on Wayland when closing the mainwindow while another dialog is open.
disconnect ( QGuiApplication : : clipboard ( ) , & QClipboard : : dataChanged , this , & DolphinMainWindow : : updatePasteAction ) ;
2007-04-01 18:36:23 +00:00
}
2020-11-05 22:30:07 +00:00
QVector < DolphinViewContainer * > DolphinMainWindow : : viewContainers ( ) const
Add Bookmark Handling
Summary:
Add Bookmark Handling. Adds complete bookmark support as provided by
other KDE applications like Konsole and Konqueror. This allows you to
bookmark individual folders, create bookmark folders and open them.
Test Plan:
Go -> Bookmark -> Add Bookmark
Go -> Bookmark -> [Open the bookmark you selected]
FEATURE: 171366
Reviewers: #dolphin, elvisangelaccio, ngraham
Reviewed By: #dolphin, elvisangelaccio, ngraham
Subscribers: ognarb, meven, loh.tar, cfeck, hein, kfm-devel
Tags: #dolphin
Maniphest Tasks: T5408
Differential Revision: https://phabricator.kde.org/D19926
2019-03-20 19:29:20 +00:00
{
QVector < DolphinViewContainer * > viewContainers ;
2020-10-17 00:35:54 +00:00
Add Bookmark Handling
Summary:
Add Bookmark Handling. Adds complete bookmark support as provided by
other KDE applications like Konsole and Konqueror. This allows you to
bookmark individual folders, create bookmark folders and open them.
Test Plan:
Go -> Bookmark -> Add Bookmark
Go -> Bookmark -> [Open the bookmark you selected]
FEATURE: 171366
Reviewers: #dolphin, elvisangelaccio, ngraham
Reviewed By: #dolphin, elvisangelaccio, ngraham
Subscribers: ognarb, meven, loh.tar, cfeck, hein, kfm-devel
Tags: #dolphin
Maniphest Tasks: T5408
Differential Revision: https://phabricator.kde.org/D19926
2019-03-20 19:29:20 +00:00
for ( int i = 0 ; i < m_tabWidget - > count ( ) ; + + i ) {
2020-10-17 00:35:54 +00:00
DolphinTabPage * tabPage = m_tabWidget - > tabPageAt ( i ) ;
viewContainers < < tabPage - > primaryViewContainer ( ) ;
if ( tabPage - > splitViewEnabled ( ) ) {
viewContainers < < tabPage - > secondaryViewContainer ( ) ;
}
Add Bookmark Handling
Summary:
Add Bookmark Handling. Adds complete bookmark support as provided by
other KDE applications like Konsole and Konqueror. This allows you to
bookmark individual folders, create bookmark folders and open them.
Test Plan:
Go -> Bookmark -> Add Bookmark
Go -> Bookmark -> [Open the bookmark you selected]
FEATURE: 171366
Reviewers: #dolphin, elvisangelaccio, ngraham
Reviewed By: #dolphin, elvisangelaccio, ngraham
Subscribers: ognarb, meven, loh.tar, cfeck, hein, kfm-devel
Tags: #dolphin
Maniphest Tasks: T5408
Differential Revision: https://phabricator.kde.org/D19926
2019-03-20 19:29:20 +00:00
}
return viewContainers ;
}
2015-04-27 10:55:53 +00:00
void DolphinMainWindow : : openDirectories ( const QList < QUrl > & dirs , bool splitView )
2009-12-17 21:07:18 +00:00
{
2015-04-27 10:55:53 +00:00
m_tabWidget - > openDirectories ( dirs , splitView ) ;
2009-12-17 21:07:18 +00:00
}
Open externally called files/directories in new tabs
Summary:
FEATURE: 183429
FIXED-IN: 19.08.0
GUI: new cli argument --new-window
Externally called files/directories are opened in a a new tab of an instance of Dolphin that already exists. If any of the given URIs are already open in a tab, then those tabs are activated instead of a new tab being opened. If there is no instance then the files/directories are opened in a new window. The newly opened file/directory has its tab activated, and consequently, the window is also activated.
When the user clicks "Open In New Window" or "Detach Tab", the files/directories are opened in a new window.
Test Plan:
[Manual]
Before testing, set the default file manager in system settings as the newly built Dolphin executable.
One must also include the new dolphin executable in the $PATH, otherwise some functions will attempt to open the system dolphin instead of the new one.
Furthermore, running two different versions of Dolphin (in particular, where one does not have this patch included) can result in bugs appearing, in particular, new tabs not opening as old instances will not recognise the DBus commands sent to it. However, I see no reason why a user will have two different versions of Dolphin (apart from people like us :D).
Open directories with the help of auxillary programs (i.e. a browser). The files/directories should appear in a new window if an instance does not exist. If an existence already exists, then a new tab should be opened and activated in that instance and the window activated.
Use QDBusViewer to open folders/items by calling the ShowFolders/ShowItems methods in org.freedesktop.FileManager1 of the Dolphin instance.
When a user chooses to "Open In New Window"/"Detach Tab" then the files/directories should be opened in a new window.
Reviewers: #dolphin, elvisangelaccio
Subscribers: zzag, dfaure, fvogt, fikrim, magar, fbg13, davidedmundson, kwin, ngraham, elvisangelaccio, anthonyfieroni, kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D16648
2019-05-30 20:22:43 +00:00
void DolphinMainWindow : : openDirectories ( const QStringList & dirs , bool splitView )
{
openDirectories ( QUrl : : fromStringList ( dirs ) , splitView ) ;
}
2015-04-27 10:55:53 +00:00
void DolphinMainWindow : : openFiles ( const QList < QUrl > & files , bool splitView )
2009-12-17 21:07:18 +00:00
{
2015-04-27 10:55:53 +00:00
m_tabWidget - > openFiles ( files , splitView ) ;
2009-12-17 21:07:18 +00:00
}
2020-08-18 21:47:53 +00:00
bool DolphinMainWindow : : isFoldersPanelEnabled ( ) const
{
return actionCollection ( ) - > action ( QStringLiteral ( " show_folders_panel " ) ) - > isChecked ( ) ;
}
bool DolphinMainWindow : : isInformationPanelEnabled ( ) const
{
2022-06-11 17:16:13 +00:00
# if HAVE_BALOO
2020-08-18 21:47:53 +00:00
return actionCollection ( ) - > action ( QStringLiteral ( " show_information_panel " ) ) - > isChecked ( ) ;
2021-01-20 14:29:04 +00:00
# else
return false ;
# endif
2020-08-18 21:47:53 +00:00
}
Open externally called files/directories in new tabs
Summary:
FEATURE: 183429
FIXED-IN: 19.08.0
GUI: new cli argument --new-window
Externally called files/directories are opened in a a new tab of an instance of Dolphin that already exists. If any of the given URIs are already open in a tab, then those tabs are activated instead of a new tab being opened. If there is no instance then the files/directories are opened in a new window. The newly opened file/directory has its tab activated, and consequently, the window is also activated.
When the user clicks "Open In New Window" or "Detach Tab", the files/directories are opened in a new window.
Test Plan:
[Manual]
Before testing, set the default file manager in system settings as the newly built Dolphin executable.
One must also include the new dolphin executable in the $PATH, otherwise some functions will attempt to open the system dolphin instead of the new one.
Furthermore, running two different versions of Dolphin (in particular, where one does not have this patch included) can result in bugs appearing, in particular, new tabs not opening as old instances will not recognise the DBus commands sent to it. However, I see no reason why a user will have two different versions of Dolphin (apart from people like us :D).
Open directories with the help of auxillary programs (i.e. a browser). The files/directories should appear in a new window if an instance does not exist. If an existence already exists, then a new tab should be opened and activated in that instance and the window activated.
Use QDBusViewer to open folders/items by calling the ShowFolders/ShowItems methods in org.freedesktop.FileManager1 of the Dolphin instance.
When a user chooses to "Open In New Window"/"Detach Tab" then the files/directories should be opened in a new window.
Reviewers: #dolphin, elvisangelaccio
Subscribers: zzag, dfaure, fvogt, fikrim, magar, fbg13, davidedmundson, kwin, ngraham, elvisangelaccio, anthonyfieroni, kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D16648
2019-05-30 20:22:43 +00:00
void DolphinMainWindow : : openFiles ( const QStringList & files , bool splitView )
{
openFiles ( QUrl : : fromStringList ( files ) , splitView ) ;
}
2022-10-11 19:21:09 +00:00
void DolphinMainWindow : : activateWindow ( const QString & activationToken )
Open externally called files/directories in new tabs
Summary:
FEATURE: 183429
FIXED-IN: 19.08.0
GUI: new cli argument --new-window
Externally called files/directories are opened in a a new tab of an instance of Dolphin that already exists. If any of the given URIs are already open in a tab, then those tabs are activated instead of a new tab being opened. If there is no instance then the files/directories are opened in a new window. The newly opened file/directory has its tab activated, and consequently, the window is also activated.
When the user clicks "Open In New Window" or "Detach Tab", the files/directories are opened in a new window.
Test Plan:
[Manual]
Before testing, set the default file manager in system settings as the newly built Dolphin executable.
One must also include the new dolphin executable in the $PATH, otherwise some functions will attempt to open the system dolphin instead of the new one.
Furthermore, running two different versions of Dolphin (in particular, where one does not have this patch included) can result in bugs appearing, in particular, new tabs not opening as old instances will not recognise the DBus commands sent to it. However, I see no reason why a user will have two different versions of Dolphin (apart from people like us :D).
Open directories with the help of auxillary programs (i.e. a browser). The files/directories should appear in a new window if an instance does not exist. If an existence already exists, then a new tab should be opened and activated in that instance and the window activated.
Use QDBusViewer to open folders/items by calling the ShowFolders/ShowItems methods in org.freedesktop.FileManager1 of the Dolphin instance.
When a user chooses to "Open In New Window"/"Detach Tab" then the files/directories should be opened in a new window.
Reviewers: #dolphin, elvisangelaccio
Subscribers: zzag, dfaure, fvogt, fikrim, magar, fbg13, davidedmundson, kwin, ngraham, elvisangelaccio, anthonyfieroni, kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D16648
2019-05-30 20:22:43 +00:00
{
2019-11-10 13:19:17 +00:00
window ( ) - > setAttribute ( Qt : : WA_NativeWindow , true ) ;
2022-10-11 19:21:09 +00:00
if ( KWindowSystem : : isPlatformWayland ( ) ) {
KWindowSystem : : setCurrentXdgActivationToken ( activationToken ) ;
} else {
2022-12-14 23:56:11 +00:00
KStartupInfo : : setNewStartupId ( window ( ) - > windowHandle ( ) , activationToken . toUtf8 ( ) ) ;
2022-10-11 19:21:09 +00:00
}
KWindowSystem : : activateWindow ( window ( ) - > windowHandle ( ) ) ;
Open externally called files/directories in new tabs
Summary:
FEATURE: 183429
FIXED-IN: 19.08.0
GUI: new cli argument --new-window
Externally called files/directories are opened in a a new tab of an instance of Dolphin that already exists. If any of the given URIs are already open in a tab, then those tabs are activated instead of a new tab being opened. If there is no instance then the files/directories are opened in a new window. The newly opened file/directory has its tab activated, and consequently, the window is also activated.
When the user clicks "Open In New Window" or "Detach Tab", the files/directories are opened in a new window.
Test Plan:
[Manual]
Before testing, set the default file manager in system settings as the newly built Dolphin executable.
One must also include the new dolphin executable in the $PATH, otherwise some functions will attempt to open the system dolphin instead of the new one.
Furthermore, running two different versions of Dolphin (in particular, where one does not have this patch included) can result in bugs appearing, in particular, new tabs not opening as old instances will not recognise the DBus commands sent to it. However, I see no reason why a user will have two different versions of Dolphin (apart from people like us :D).
Open directories with the help of auxillary programs (i.e. a browser). The files/directories should appear in a new window if an instance does not exist. If an existence already exists, then a new tab should be opened and activated in that instance and the window activated.
Use QDBusViewer to open folders/items by calling the ShowFolders/ShowItems methods in org.freedesktop.FileManager1 of the Dolphin instance.
When a user chooses to "Open In New Window"/"Detach Tab" then the files/directories should be opened in a new window.
Reviewers: #dolphin, elvisangelaccio
Subscribers: zzag, dfaure, fvogt, fikrim, magar, fbg13, davidedmundson, kwin, ngraham, elvisangelaccio, anthonyfieroni, kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D16648
2019-05-30 20:22:43 +00:00
}
2022-05-24 13:24:24 +00:00
bool DolphinMainWindow : : isActiveWindow ( )
{
return window ( ) - > isActiveWindow ( ) ;
}
2008-10-01 21:39:35 +00:00
void DolphinMainWindow : : showCommand ( CommandType command )
2007-06-12 21:45:22 +00:00
{
2008-10-01 21:39:35 +00:00
DolphinStatusBar * statusBar = m_activeViewContainer - > statusBar ( ) ;
switch ( command ) {
case KIO : : FileUndoManager : : Copy :
2012-04-12 21:57:51 +00:00
statusBar - > setText ( i18nc ( " @info:status " , " Successfully copied. " ) ) ;
2008-10-01 21:39:35 +00:00
break ;
case KIO : : FileUndoManager : : Move :
2012-04-12 21:57:51 +00:00
statusBar - > setText ( i18nc ( " @info:status " , " Successfully moved. " ) ) ;
2008-10-01 21:39:35 +00:00
break ;
case KIO : : FileUndoManager : : Link :
2012-04-12 21:57:51 +00:00
statusBar - > setText ( i18nc ( " @info:status " , " Successfully linked. " ) ) ;
2008-10-01 21:39:35 +00:00
break ;
case KIO : : FileUndoManager : : Trash :
2012-04-12 21:57:51 +00:00
statusBar - > setText ( i18nc ( " @info:status " , " Successfully moved to trash. " ) ) ;
2008-10-01 21:39:35 +00:00
break ;
case KIO : : FileUndoManager : : Rename :
2012-04-12 21:57:51 +00:00
statusBar - > setText ( i18nc ( " @info:status " , " Successfully renamed. " ) ) ;
2008-10-01 21:39:35 +00:00
break ;
case KIO : : FileUndoManager : : Mkdir :
2012-04-12 21:57:51 +00:00
statusBar - > setText ( i18nc ( " @info:status " , " Created folder. " ) ) ;
2008-10-01 21:39:35 +00:00
break ;
default :
break ;
}
2007-06-12 21:45:22 +00:00
}
2007-04-01 18:36:23 +00:00
2008-03-29 14:54:56 +00:00
void DolphinMainWindow : : pasteIntoFolder ( )
{
m_activeViewContainer - > view ( ) - > pasteIntoFolder ( ) ;
}
2014-10-21 19:18:43 +00:00
void DolphinMainWindow : : changeUrl ( const QUrl & url )
2007-04-01 18:36:23 +00:00
{
2008-10-07 22:05:55 +00:00
if ( ! KProtocolManager : : supportsListing ( url ) ) {
2008-10-07 20:29:18 +00:00
// The URL navigator only checks for validity, not
// if the URL can be listed. An error message is
// shown due to DolphinViewContainer::restoreView().
return ;
}
2008-12-12 06:55:26 +00:00
2014-08-10 16:52:06 +00:00
m_activeViewContainer - > setUrl ( url ) ;
2019-09-01 21:01:57 +00:00
updateFileAndEditActions ( ) ;
2014-08-10 16:52:06 +00:00
updatePasteAction ( ) ;
updateViewActions ( ) ;
updateGoActions ( ) ;
2020-10-23 17:51:33 +00:00
Q_EMIT urlChanged ( url ) ;
2007-04-01 18:36:23 +00:00
}
2014-10-21 19:18:43 +00:00
void DolphinMainWindow : : slotTerminalDirectoryChanged ( const QUrl & url )
2012-04-26 06:31:46 +00:00
{
2017-10-12 21:17:51 +00:00
if ( m_tearDownFromPlacesRequested & & url = = QUrl : : fromLocalFile ( QDir : : homePath ( ) ) ) {
m_placesPanel - > proceedWithTearDown ( ) ;
m_tearDownFromPlacesRequested = false ;
}
2012-04-26 06:31:46 +00:00
m_activeViewContainer - > setAutoGrabFocus ( false ) ;
changeUrl ( url ) ;
m_activeViewContainer - > setAutoGrabFocus ( true ) ;
}
2008-02-07 07:27:06 +00:00
void DolphinMainWindow : : slotEditableStateChanged ( bool editable )
{
KToggleAction * editableLocationAction =
2016-03-16 21:17:37 +00:00
static_cast < KToggleAction * > ( actionCollection ( ) - > action ( QStringLiteral ( " editable_location " ) ) ) ;
2008-02-07 07:27:06 +00:00
editableLocationAction - > setChecked ( editable ) ;
}
2007-10-02 19:03:03 +00:00
void DolphinMainWindow : : slotSelectionChanged ( const KFileItemList & selection )
2007-04-01 18:36:23 +00:00
{
2019-09-01 21:01:57 +00:00
updateFileAndEditActions ( ) ;
2007-04-01 18:36:23 +00:00
2014-08-10 16:52:06 +00:00
const int selectedUrlsCount = m_tabWidget - > currentTabPage ( ) - > selectedItemsCount ( ) ;
2007-04-01 18:36:23 +00:00
2016-03-16 21:17:37 +00:00
QAction * compareFilesAction = actionCollection ( ) - > action ( QStringLiteral ( " compare_files " ) ) ;
2007-12-18 15:08:59 +00:00
if ( selectedUrlsCount = = 2 ) {
2008-06-28 18:42:51 +00:00
compareFilesAction - > setEnabled ( isKompareInstalled ( ) ) ;
2007-12-18 15:08:59 +00:00
} else {
compareFilesAction - > setEnabled ( false ) ;
}
2007-04-01 18:36:23 +00:00
2020-10-23 17:51:33 +00:00
Q_EMIT selectionChanged ( selection ) ;
2007-04-01 18:36:23 +00:00
}
2008-02-23 15:48:56 +00:00
void DolphinMainWindow : : updateHistory ( )
2007-04-01 18:36:23 +00:00
{
2020-08-27 16:55:18 +00:00
const KUrlNavigator * urlNavigator = m_activeViewContainer - > urlNavigatorInternalWithHistory ( ) ;
2008-02-23 15:48:56 +00:00
const int index = urlNavigator - > historyIndex ( ) ;
2018-03-10 19:50:29 +00:00
QAction * backAction = actionCollection ( ) - > action ( KStandardAction : : name ( KStandardAction : : Back ) ) ;
2011-02-09 18:21:58 +00:00
if ( backAction ) {
2011-10-09 09:12:22 +00:00
backAction - > setToolTip ( i18nc ( " @info " , " Go back " ) ) ;
2019-06-23 19:19:49 +00:00
backAction - > setWhatsThis ( i18nc ( " @info:whatsthis go back " , " Return to the previously viewed folder. " ) ) ;
2008-02-23 15:48:56 +00:00
backAction - > setEnabled ( index < urlNavigator - > historySize ( ) - 1 ) ;
}
2018-03-10 19:50:29 +00:00
QAction * forwardAction = actionCollection ( ) - > action ( KStandardAction : : name ( KStandardAction : : Forward ) ) ;
2011-02-09 18:21:58 +00:00
if ( forwardAction ) {
2011-10-09 09:12:22 +00:00
forwardAction - > setToolTip ( i18nc ( " @info " , " Go forward " ) ) ;
2019-06-23 19:19:49 +00:00
forwardAction - > setWhatsThis ( xi18nc ( " @info:whatsthis go forward " ,
" This undoes a <interface>Go|Back</interface> action. " ) ) ;
2008-02-23 15:48:56 +00:00
forwardAction - > setEnabled ( index > 0 ) ;
}
2007-04-01 18:36:23 +00:00
}
void DolphinMainWindow : : updateFilterBarAction ( bool show )
{
2020-12-02 07:07:41 +00:00
QAction * toggleFilterBarAction = actionCollection ( ) - > action ( QStringLiteral ( " toggle_filter " ) ) ;
toggleFilterBarAction - > setChecked ( show ) ;
2007-04-01 18:36:23 +00:00
}
void DolphinMainWindow : : openNewMainWindow ( )
{
2017-03-27 22:52:29 +00:00
Dolphin : : openNewWindow ( { m_activeViewContainer - > url ( ) } , this ) ;
2007-04-01 18:36:23 +00:00
}
2014-08-10 16:52:06 +00:00
void DolphinMainWindow : : openNewActivatedTab ( )
2008-04-12 15:09:46 +00:00
{
2020-12-12 13:17:23 +00:00
// keep browsers compatibility, new tab is always after last one
auto openNewTabAfterLastTabConfigured = GeneralSettings : : openNewTabAfterLastTab ( ) ;
GeneralSettings : : setOpenNewTabAfterLastTab ( true ) ;
2014-08-10 16:52:06 +00:00
m_tabWidget - > openNewActivatedTab ( ) ;
2020-12-12 13:17:23 +00:00
GeneralSettings : : setOpenNewTabAfterLastTab ( openNewTabAfterLastTabConfigured ) ;
2008-04-12 15:09:46 +00:00
}
2019-09-01 21:01:57 +00:00
void DolphinMainWindow : : addToPlaces ( )
{
QUrl url ;
QString name ;
// If nothing is selected, act on the current dir
2019-09-14 07:40:09 +00:00
if ( m_activeViewContainer - > view ( ) - > selectedItems ( ) . isEmpty ( ) ) {
2019-09-01 21:01:57 +00:00
url = m_activeViewContainer - > url ( ) ;
name = m_activeViewContainer - > placesText ( ) ;
} else {
const auto dirToAdd = m_activeViewContainer - > view ( ) - > selectedItems ( ) . first ( ) ;
url = dirToAdd . url ( ) ;
name = dirToAdd . name ( ) ;
}
if ( url . isValid ( ) ) {
QString icon ;
if ( m_activeViewContainer - > isSearchModeEnabled ( ) ) {
icon = QStringLiteral ( " folder-saved-search-symbolic " ) ;
} else {
icon = KIO : : iconNameForUrl ( url ) ;
}
2021-12-16 18:29:22 +00:00
DolphinPlacesModelSingleton : : instance ( ) . placesModel ( ) - > addPlace ( name , url , icon ) ;
2019-09-01 21:01:57 +00:00
}
}
2020-12-12 13:17:23 +00:00
void DolphinMainWindow : : openNewTab ( const QUrl & url )
2008-04-12 16:12:57 +00:00
{
2020-12-12 13:17:23 +00:00
m_tabWidget - > openNewTab ( url , QUrl ( ) ) ;
2008-04-12 16:12:57 +00:00
}
2021-12-17 14:11:46 +00:00
void DolphinMainWindow : : openNewTabAndActivate ( const QUrl & url )
{
m_tabWidget - > openNewActivatedTab ( url , QUrl ( ) ) ;
}
void DolphinMainWindow : : openNewWindow ( const QUrl & url )
{
Dolphin : : openNewWindow ( { url } , this ) ;
}
2021-09-28 19:39:52 +00:00
void DolphinMainWindow : : slotSplitViewChanged ( )
{
m_tabWidget - > currentTabPage ( ) - > setSplitViewEnabled ( GeneralSettings : : splitView ( ) , WithAnimation ) ;
updateSplitAction ( ) ;
}
2008-10-25 10:32:55 +00:00
void DolphinMainWindow : : openInNewTab ( )
{
2013-05-22 19:47:14 +00:00
const KFileItemList & list = m_activeViewContainer - > view ( ) - > selectedItems ( ) ;
2017-06-11 17:26:52 +00:00
bool tabCreated = false ;
2020-10-23 17:48:22 +00:00
for ( const KFileItem & item : list ) {
2017-06-11 17:26:52 +00:00
const QUrl & url = DolphinView : : openItemAsFolderUrl ( item ) ;
if ( ! url . isEmpty ( ) ) {
2020-12-12 13:17:23 +00:00
openNewTab ( url ) ;
2017-06-11 17:26:52 +00:00
tabCreated = true ;
2013-05-22 19:47:14 +00:00
}
2008-10-25 10:32:55 +00:00
}
2017-06-11 17:26:52 +00:00
// if no new tab has been created from the selection
// open the current directory in a new tab
if ( ! tabCreated ) {
2020-12-12 13:17:23 +00:00
openNewTab ( m_activeViewContainer - > url ( ) ) ;
2017-06-11 17:26:52 +00:00
}
2008-10-25 10:32:55 +00:00
}
void DolphinMainWindow : : openInNewWindow ( )
{
2014-10-21 19:18:43 +00:00
QUrl newWindowUrl ;
2010-10-06 15:04:37 +00:00
2008-10-25 10:32:55 +00:00
const KFileItemList list = m_activeViewContainer - > view ( ) - > selectedItems ( ) ;
2010-10-06 15:04:37 +00:00
if ( list . isEmpty ( ) ) {
newWindowUrl = m_activeViewContainer - > url ( ) ;
2013-05-28 15:31:14 +00:00
} else if ( list . count ( ) = = 1 ) {
const KFileItem & item = list . first ( ) ;
newWindowUrl = DolphinView : : openItemAsFolderUrl ( item ) ;
2010-10-06 15:04:37 +00:00
}
if ( ! newWindowUrl . isEmpty ( ) ) {
2017-03-08 15:52:15 +00:00
Dolphin : : openNewWindow ( { newWindowUrl } , this ) ;
2008-10-25 10:32:55 +00:00
}
}
2018-03-18 10:55:24 +00:00
void DolphinMainWindow : : showTarget ( )
{
const auto link = m_activeViewContainer - > view ( ) - > selectedItems ( ) . at ( 0 ) ;
const auto linkLocationDir = QFileInfo ( link . localPath ( ) ) . absoluteDir ( ) ;
auto linkDestination = link . linkDest ( ) ;
if ( QFileInfo ( linkDestination ) . isRelative ( ) ) {
linkDestination = linkLocationDir . filePath ( linkDestination ) ;
}
if ( QFileInfo : : exists ( linkDestination ) ) {
KIO : : highlightInFileManager ( { QUrl : : fromLocalFile ( linkDestination ) . adjusted ( QUrl : : StripTrailingSlash ) } ) ;
} else {
m_activeViewContainer - > showMessage ( xi18nc ( " @info " , " Could not access <filename>%1</filename>. " , linkDestination ) ,
DolphinViewContainer : : Warning ) ;
}
}
2010-01-11 09:21:16 +00:00
void DolphinMainWindow : : showEvent ( QShowEvent * event )
{
KXmlGuiWindow : : showEvent ( event ) ;
2014-07-08 17:16:17 +00:00
2010-01-11 09:21:16 +00:00
if ( ! event - > spontaneous ( ) ) {
m_activeViewContainer - > view ( ) - > setFocus ( ) ;
}
}
2007-04-01 18:36:23 +00:00
void DolphinMainWindow : : closeEvent ( QCloseEvent * event )
{
2009-08-13 18:54:16 +00:00
// Find out if Dolphin is closed directly by the user or
// by the session manager because the session is closed
bool closedByUser = true ;
2016-01-28 20:03:14 +00:00
if ( qApp - > isSavingSession ( ) ) {
2009-08-13 18:54:16 +00:00
closedByUser = false ;
}
2020-10-03 15:39:16 +00:00
if ( m_tabWidget - > count ( ) > 1
& & GeneralSettings : : confirmClosingMultipleTabs ( )
& & ! GeneralSettings : : rememberOpenedTabs ( )
& & closedByUser ) {
2009-03-12 22:40:32 +00:00
// Ask the user if he really wants to quit and close all tabs.
// Open a confirmation dialog with 3 buttons:
2015-02-03 08:25:33 +00:00
// QDialogButtonBox::Yes -> Quit
// QDialogButtonBox::No -> Close only the current tab
// QDialogButtonBox::Cancel -> do nothing
2014-04-06 01:32:55 +00:00
QDialog * dialog = new QDialog ( this , Qt : : Dialog ) ;
dialog - > setWindowTitle ( i18nc ( " @title:window " , " Confirmation " ) ) ;
2009-03-12 22:40:32 +00:00
dialog - > setModal ( true ) ;
2014-04-06 01:32:55 +00:00
QDialogButtonBox * buttons = new QDialogButtonBox ( QDialogButtonBox : : Yes | QDialogButtonBox : : No | QDialogButtonBox : : Cancel ) ;
2018-04-29 15:13:18 +00:00
KGuiItem : : assign ( buttons - > button ( QDialogButtonBox : : Yes ) , KGuiItem ( i18nc ( " @action:button 'Quit Dolphin' button " , " &Quit %1 " , QGuiApplication : : applicationDisplayName ( ) ) , QIcon : : fromTheme ( QStringLiteral ( " application-exit " ) ) ) ) ;
2016-03-16 21:17:37 +00:00
KGuiItem : : assign ( buttons - > button ( QDialogButtonBox : : No ) , KGuiItem ( i18n ( " C&lose Current Tab " ) , QIcon : : fromTheme ( QStringLiteral ( " tab-close " ) ) ) ) ;
2014-04-06 01:32:55 +00:00
KGuiItem : : assign ( buttons - > button ( QDialogButtonBox : : Cancel ) , KStandardGuiItem : : cancel ( ) ) ;
buttons - > button ( QDialogButtonBox : : Yes ) - > setDefault ( true ) ;
2009-03-12 22:40:32 +00:00
bool doNotAskAgainCheckboxResult = false ;
Ask for confirmation when Closing Dolphin windows with a terminal panel running a program
Summary:
Ask for confirmation when Closing Dolphin windows with a terminal panel running a program.
FEATURE: 304816
FIXED-IN: 19.04.0
Test Plan:
# Open terminal panel
# Run `watch ls`
# Close Dolphin
# Observe confirmation
# Disable confirmation
# Repeat, observe no confirmation
# Enable confirmation in the settings
# Repeat, observe a confirmation
Reviewers: #dolphin, markg, elvisangelaccio, rominf
Reviewed By: #dolphin, elvisangelaccio
Subscribers: kfm-devel, elvisangelaccio, markg, ngraham, rkflx, broulik, #dolphin
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D10960
2019-01-19 15:11:26 +00:00
const auto result = KMessageBox : : createKMessageBox ( dialog ,
2014-04-06 01:32:55 +00:00
buttons ,
2009-03-12 22:40:32 +00:00
QMessageBox : : Warning ,
i18n ( " You have multiple tabs open in this window, are you sure you want to quit? " ) ,
QStringList ( ) ,
i18n ( " Do not ask again " ) ,
& doNotAskAgainCheckboxResult ,
KMessageBox : : Notify ) ;
if ( doNotAskAgainCheckboxResult ) {
2011-11-06 10:58:48 +00:00
GeneralSettings : : setConfirmClosingMultipleTabs ( false ) ;
2009-03-12 22:40:32 +00:00
}
switch ( result ) {
2014-06-04 19:56:36 +00:00
case QDialogButtonBox : : Yes :
2009-03-12 22:40:32 +00:00
// Quit
break ;
2014-06-04 19:56:36 +00:00
case QDialogButtonBox : : No :
2009-03-12 22:40:32 +00:00
// Close only the current tab
2014-08-10 16:52:06 +00:00
m_tabWidget - > closeTab ( ) ;
2018-03-08 09:21:13 +00:00
Q_FALLTHROUGH ( ) ;
2009-03-12 22:40:32 +00:00
default :
event - > ignore ( ) ;
return ;
Ask for confirmation when Closing Dolphin windows with a terminal panel running a program
Summary:
Ask for confirmation when Closing Dolphin windows with a terminal panel running a program.
FEATURE: 304816
FIXED-IN: 19.04.0
Test Plan:
# Open terminal panel
# Run `watch ls`
# Close Dolphin
# Observe confirmation
# Disable confirmation
# Repeat, observe no confirmation
# Enable confirmation in the settings
# Repeat, observe a confirmation
Reviewers: #dolphin, markg, elvisangelaccio, rominf
Reviewed By: #dolphin, elvisangelaccio
Subscribers: kfm-devel, elvisangelaccio, markg, ngraham, rkflx, broulik, #dolphin
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D10960
2019-01-19 15:11:26 +00:00
}
}
2019-10-01 09:23:12 +00:00
if ( m_terminalPanel & & m_terminalPanel - > hasProgramRunning ( ) & & GeneralSettings : : confirmClosingTerminalRunningProgram ( ) & & closedByUser ) {
Ask for confirmation when Closing Dolphin windows with a terminal panel running a program
Summary:
Ask for confirmation when Closing Dolphin windows with a terminal panel running a program.
FEATURE: 304816
FIXED-IN: 19.04.0
Test Plan:
# Open terminal panel
# Run `watch ls`
# Close Dolphin
# Observe confirmation
# Disable confirmation
# Repeat, observe no confirmation
# Enable confirmation in the settings
# Repeat, observe a confirmation
Reviewers: #dolphin, markg, elvisangelaccio, rominf
Reviewed By: #dolphin, elvisangelaccio
Subscribers: kfm-devel, elvisangelaccio, markg, ngraham, rkflx, broulik, #dolphin
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D10960
2019-01-19 15:11:26 +00:00
// Ask if the user really wants to quit Dolphin with a program that is still running in the Terminal panel
// Open a confirmation dialog with 3 buttons:
// QDialogButtonBox::Yes -> Quit
// QDialogButtonBox::No -> Show Terminal Panel
// QDialogButtonBox::Cancel -> do nothing
QDialog * dialog = new QDialog ( this , Qt : : Dialog ) ;
dialog - > setWindowTitle ( i18nc ( " @title:window " , " Confirmation " ) ) ;
dialog - > setModal ( true ) ;
auto standardButtons = QDialogButtonBox : : Yes | QDialogButtonBox : : Cancel ;
if ( ! m_terminalPanel - > isVisible ( ) ) {
standardButtons | = QDialogButtonBox : : No ;
}
QDialogButtonBox * buttons = new QDialogButtonBox ( standardButtons ) ;
KGuiItem : : assign ( buttons - > button ( QDialogButtonBox : : Yes ) , KStandardGuiItem : : quit ( ) ) ;
if ( ! m_terminalPanel - > isVisible ( ) ) {
KGuiItem : : assign (
buttons - > button ( QDialogButtonBox : : No ) ,
2019-09-05 15:30:06 +00:00
KGuiItem ( i18n ( " Show &Terminal Panel " ) , QIcon : : fromTheme ( QStringLiteral ( " dialog-scripts " ) ) ) ) ;
Ask for confirmation when Closing Dolphin windows with a terminal panel running a program
Summary:
Ask for confirmation when Closing Dolphin windows with a terminal panel running a program.
FEATURE: 304816
FIXED-IN: 19.04.0
Test Plan:
# Open terminal panel
# Run `watch ls`
# Close Dolphin
# Observe confirmation
# Disable confirmation
# Repeat, observe no confirmation
# Enable confirmation in the settings
# Repeat, observe a confirmation
Reviewers: #dolphin, markg, elvisangelaccio, rominf
Reviewed By: #dolphin, elvisangelaccio
Subscribers: kfm-devel, elvisangelaccio, markg, ngraham, rkflx, broulik, #dolphin
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D10960
2019-01-19 15:11:26 +00:00
}
KGuiItem : : assign ( buttons - > button ( QDialogButtonBox : : Cancel ) , KStandardGuiItem : : cancel ( ) ) ;
bool doNotAskAgainCheckboxResult = false ;
const auto result = KMessageBox : : createKMessageBox (
dialog ,
buttons ,
QMessageBox : : Warning ,
i18n ( " The program '%1' is still running in the Terminal panel. Are you sure you want to quit? " , m_terminalPanel - > runningProgramName ( ) ) ,
QStringList ( ) ,
i18n ( " Do not ask again " ) ,
& doNotAskAgainCheckboxResult ,
KMessageBox : : Dangerous ) ;
if ( doNotAskAgainCheckboxResult ) {
GeneralSettings : : setConfirmClosingTerminalRunningProgram ( false ) ;
}
switch ( result ) {
case QDialogButtonBox : : Yes :
// Quit
break ;
case QDialogButtonBox : : No :
actionCollection ( ) - > action ( " show_terminal_panel " ) - > trigger ( ) ;
// Do not quit, ignore quit event
Q_FALLTHROUGH ( ) ;
default :
event - > ignore ( ) ;
return ;
2009-03-12 22:40:32 +00:00
}
}
Add an option to show tabs from last time when Dolphin starts
Summary:
All modern web browsers offer a function to show tabs from last time when a browser starts, and many apps today
restore their prior state when they're launched. This patch implements thatfunctionality as an option and turns it on by default.
The settings window is accordingly adjusted to be clear about what applies when:
{F7681752}
FEATURE: 413564
FIXED-IN: 20.08.0
Depends on D25106
Depends on D25219
Test Plan:
With the new setting turned off:
- No behavioral changes at all
With the new setting turned on:
- When launched from the GUI or CLI without any URLs, dolphin restores session
- When rebooting with Dolphin open, it restores session normally after the system comes back (i.e. no behavioral change here)
- When launched with URLs, Dolphin window is opened showing those URLs instead of restoring session
- When Dolphin is already running and a new window is opened, that new window shows a single tab with the same URL as was visible in the previously-open Dolphin instance (i.e. no behavioral change here)
- "Open Containing folder" functionality in other apps works regardless of whether or not Dolphin is running
Reviewers: #dolphin, #vdg, feverfew, meven, elvisangelaccio, ndavis
Reviewed By: #dolphin, #vdg, feverfew, elvisangelaccio, ndavis
Subscribers: davidedmundson, ndavis, intika, feverfew, kfm-devel, ngraham, broulik, #dolphin
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D11382
2019-07-19 17:52:12 +00:00
if ( GeneralSettings : : rememberOpenedTabs ( ) ) {
KConfigGui : : setSessionConfig ( QStringLiteral ( " dolphin " ) , QStringLiteral ( " dolphin " ) ) ;
KConfig * config = KConfigGui : : sessionConfig ( ) ;
saveGlobalProperties ( config ) ;
savePropertiesInternal ( config , 1 ) ;
config - > sync ( ) ;
}
2011-11-06 10:58:48 +00:00
GeneralSettings : : setVersion ( CurrentDolphinVersion ) ;
2014-10-07 05:38:16 +00:00
GeneralSettings : : self ( ) - > save ( ) ;
2007-04-01 18:36:23 +00:00
2007-04-16 20:44:36 +00:00
KXmlGuiWindow : : closeEvent ( event ) ;
2007-04-01 18:36:23 +00:00
}
2007-11-30 18:42:17 +00:00
void DolphinMainWindow : : saveProperties ( KConfigGroup & group )
2007-04-01 18:36:23 +00:00
{
2014-08-10 16:52:06 +00:00
m_tabWidget - > saveProperties ( group ) ;
2007-04-01 18:36:23 +00:00
}
2007-11-30 18:42:17 +00:00
void DolphinMainWindow : : readProperties ( const KConfigGroup & group )
2007-04-01 18:36:23 +00:00
{
2014-08-10 16:52:06 +00:00
m_tabWidget - > readProperties ( group ) ;
2007-04-01 18:36:23 +00:00
}
void DolphinMainWindow : : updateNewMenu ( )
{
2010-08-27 05:26:27 +00:00
m_newFileMenu - > checkUpToDate ( ) ;
2021-12-14 20:47:20 +00:00
# if KIO_VERSION >= QT_VERSION_CHECK(5, 97, 0)
m_newFileMenu - > setWorkingDirectory ( activeViewContainer ( ) - > url ( ) ) ;
# else
2019-12-06 12:31:43 +00:00
m_newFileMenu - > setPopupFiles ( QList < QUrl > ( ) < < activeViewContainer ( ) - > url ( ) ) ;
2021-12-14 20:47:20 +00:00
# endif
2007-04-01 18:36:23 +00:00
}
2009-03-26 18:44:36 +00:00
void DolphinMainWindow : : createDirectory ( )
{
2021-12-14 20:47:20 +00:00
# if KIO_VERSION >= QT_VERSION_CHECK(5, 97, 0)
m_newFileMenu - > setWorkingDirectory ( activeViewContainer ( ) - > url ( ) ) ;
# else
2019-12-06 12:31:43 +00:00
m_newFileMenu - > setPopupFiles ( QList < QUrl > ( ) < < activeViewContainer ( ) - > url ( ) ) ;
2021-12-14 20:47:20 +00:00
# endif
2010-08-27 05:26:27 +00:00
m_newFileMenu - > createDirectory ( ) ;
2009-03-26 18:44:36 +00:00
}
2007-04-01 18:36:23 +00:00
void DolphinMainWindow : : quit ( )
{
close ( ) ;
}
2008-11-08 16:22:30 +00:00
void DolphinMainWindow : : showErrorMessage ( const QString & message )
2007-06-15 00:52:25 +00:00
{
2012-04-12 21:57:51 +00:00
m_activeViewContainer - > showMessage ( message , DolphinViewContainer : : Error ) ;
2007-06-15 00:52:25 +00:00
}
2007-04-01 18:36:23 +00:00
void DolphinMainWindow : : slotUndoAvailable ( bool available )
{
2008-01-27 14:54:38 +00:00
QAction * undoAction = actionCollection ( ) - > action ( KStandardAction : : name ( KStandardAction : : Undo ) ) ;
2011-02-09 18:21:58 +00:00
if ( undoAction ) {
2007-04-01 18:36:23 +00:00
undoAction - > setEnabled ( available ) ;
}
}
void DolphinMainWindow : : slotUndoTextChanged ( const QString & text )
{
2008-01-27 14:54:38 +00:00
QAction * undoAction = actionCollection ( ) - > action ( KStandardAction : : name ( KStandardAction : : Undo ) ) ;
2011-02-09 18:21:58 +00:00
if ( undoAction ) {
2007-04-01 18:36:23 +00:00
undoAction - > setText ( text ) ;
}
}
void DolphinMainWindow : : undo ( )
{
clearStatusBar ( ) ;
2008-04-30 23:32:33 +00:00
KIO : : FileUndoManager : : self ( ) - > uiInterface ( ) - > setParentWidget ( this ) ;
KIO : : FileUndoManager : : self ( ) - > undo ( ) ;
2007-04-01 18:36:23 +00:00
}
void DolphinMainWindow : : cut ( )
{
2021-09-12 13:33:39 +00:00
if ( m_activeViewContainer - > view ( ) - > selectedItems ( ) . isEmpty ( ) ) {
2022-04-24 11:18:30 +00:00
m_activeViewContainer - > setSelectionModeEnabled ( true , actionCollection ( ) , SelectionMode : : BottomBar : : Contents : : CutContents ) ;
2021-09-12 13:33:39 +00:00
} else {
m_activeViewContainer - > view ( ) - > cutSelectedItemsToClipboard ( ) ;
m_activeViewContainer - > setSelectionModeEnabled ( false ) ;
}
2007-04-01 18:36:23 +00:00
}
void DolphinMainWindow : : copy ( )
{
2021-09-12 13:33:39 +00:00
if ( m_activeViewContainer - > view ( ) - > selectedItems ( ) . isEmpty ( ) ) {
2022-04-24 11:18:30 +00:00
m_activeViewContainer - > setSelectionModeEnabled ( true , actionCollection ( ) , SelectionMode : : BottomBar : : Contents : : CopyContents ) ;
2021-09-12 13:33:39 +00:00
} else {
m_activeViewContainer - > view ( ) - > copySelectedItemsToClipboard ( ) ;
m_activeViewContainer - > setSelectionModeEnabled ( false ) ;
}
2007-04-01 18:36:23 +00:00
}
void DolphinMainWindow : : paste ( )
{
2007-11-15 20:04:05 +00:00
m_activeViewContainer - > view ( ) - > paste ( ) ;
2007-04-01 18:36:23 +00:00
}
2010-07-24 16:37:07 +00:00
void DolphinMainWindow : : find ( )
{
m_activeViewContainer - > setSearchModeEnabled ( true ) ;
}
[dolphin] Add an action to toggle the searchbar
Summary:
Make search action toggle the searchbar instead of just launching it.
The search action in dolphin did only bring up the search bar, but to close it again you had to go to the closing button on the same searchbar.
This behavior in inconsistent with other dolphin actions which toggle panels or tools.
BEFORE:
{F7256652}
AFTER:
{F7256862}
BUG: 344617
FIXED-IN: 19.12.0
Closes T8473
Depends on D23075
Test Plan:
- Enable the search mode: the searchbar appears and the toolbar button gets checked
- Press the search button again, and it goes back to normal mode.
- The search button state is coherent with the searchbox
- Coherence is kept when changing to a split view or different tab
- Shorcut <Ctrl-F> does not close the searchbar, but moves the focus to it.
Reviewers: #dolphin, ngraham, #vdg, elvisangelaccio
Reviewed By: ngraham, #vdg
Subscribers: ndavis, felixernst, elvisangelaccio, kfm-devel
Tags: #dolphin
Maniphest Tasks: T8473
Differential Revision: https://phabricator.kde.org/D23232
2019-09-01 19:59:43 +00:00
void DolphinMainWindow : : updateSearchAction ( )
{
QAction * toggleSearchAction = actionCollection ( ) - > action ( QStringLiteral ( " toggle_search " ) ) ;
toggleSearchAction - > setChecked ( m_activeViewContainer - > isSearchModeEnabled ( ) ) ;
}
2007-04-01 18:36:23 +00:00
void DolphinMainWindow : : updatePasteAction ( )
{
2008-01-27 14:54:38 +00:00
QAction * pasteAction = actionCollection ( ) - > action ( KStandardAction : : name ( KStandardAction : : Paste ) ) ;
2007-11-15 20:04:05 +00:00
QPair < bool , QString > pasteInfo = m_activeViewContainer - > view ( ) - > pasteInfo ( ) ;
pasteAction - > setEnabled ( pasteInfo . first ) ;
pasteAction - > setText ( pasteInfo . second ) ;
2007-04-01 18:36:23 +00:00
}
2014-11-02 14:34:30 +00:00
void DolphinMainWindow : : slotDirectoryLoadingCompleted ( )
{
updatePasteAction ( ) ;
}
2017-08-24 13:45:28 +00:00
void DolphinMainWindow : : slotToolBarActionMiddleClicked ( QAction * action )
{
2018-03-10 19:50:29 +00:00
if ( action = = actionCollection ( ) - > action ( KStandardAction : : name ( KStandardAction : : Back ) ) ) {
2017-08-24 13:45:28 +00:00
goBackInNewTab ( ) ;
2018-03-10 19:50:29 +00:00
} else if ( action = = actionCollection ( ) - > action ( KStandardAction : : name ( KStandardAction : : Forward ) ) ) {
2017-08-24 13:45:28 +00:00
goForwardInNewTab ( ) ;
} else if ( action = = actionCollection ( ) - > action ( QStringLiteral ( " go_up " ) ) ) {
goUpInNewTab ( ) ;
} else if ( action = = actionCollection ( ) - > action ( QStringLiteral ( " go_home " ) ) ) {
goHomeInNewTab ( ) ;
}
}
2022-03-18 18:56:20 +00:00
QAction * DolphinMainWindow : : urlNavigatorHistoryAction ( const KUrlNavigator * urlNavigator , int historyIndex , QObject * parent )
{
const QUrl url = urlNavigator - > locationUrl ( historyIndex ) ;
QString text = url . toDisplayString ( QUrl : : PreferLocalFile ) ;
if ( ! urlNavigator - > showFullPath ( ) ) {
const KFilePlacesModel * placesModel = DolphinPlacesModelSingleton : : instance ( ) . placesModel ( ) ;
const QModelIndex closestIdx = placesModel - > closestItem ( url ) ;
if ( closestIdx . isValid ( ) ) {
const QUrl placeUrl = placesModel - > url ( closestIdx ) ;
text = placesModel - > text ( closestIdx ) ;
QString pathInsidePlace = url . path ( ) . mid ( placeUrl . path ( ) . length ( ) ) ;
if ( ! pathInsidePlace . isEmpty ( ) & & ! pathInsidePlace . startsWith ( QLatin1Char ( ' / ' ) ) ) {
pathInsidePlace . prepend ( QLatin1Char ( ' / ' ) ) ;
}
if ( pathInsidePlace ! = QLatin1Char ( ' / ' ) ) {
text . append ( pathInsidePlace ) ;
}
}
}
QAction * action = new QAction ( QIcon : : fromTheme ( KIO : : iconNameForUrl ( url ) ) , text , parent ) ;
action - > setData ( historyIndex ) ;
return action ;
}
Add navigation history to forward/back buttons
Summary:
Adds navigation history to forward/back buttons in the toolbar. This
changes the forward/back buttons in the toolbar to use the
KToolBarPopupAction class which provides access to a drop down menu.
Test Plan:
Browse some folders
Click the back drop down menu and navigate somewhere
Click the forward drop down menu and navigate somewhere
FEATURE: 157819
FIXED-IN: 19.12.0
Reviewers: #dolphin, ngraham, elvisangelaccio, #vdg
Reviewed By: #dolphin, ngraham, elvisangelaccio, #vdg
Subscribers: felixernst, nerdopolist, mart, richardl, ognarb, david.fontanals, abetts, kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D19311
2019-04-11 17:21:41 +00:00
void DolphinMainWindow : : slotAboutToShowBackPopupMenu ( )
{
2020-08-27 16:55:18 +00:00
const KUrlNavigator * urlNavigator = m_activeViewContainer - > urlNavigatorInternalWithHistory ( ) ;
Add navigation history to forward/back buttons
Summary:
Adds navigation history to forward/back buttons in the toolbar. This
changes the forward/back buttons in the toolbar to use the
KToolBarPopupAction class which provides access to a drop down menu.
Test Plan:
Browse some folders
Click the back drop down menu and navigate somewhere
Click the forward drop down menu and navigate somewhere
FEATURE: 157819
FIXED-IN: 19.12.0
Reviewers: #dolphin, ngraham, elvisangelaccio, #vdg
Reviewed By: #dolphin, ngraham, elvisangelaccio, #vdg
Subscribers: felixernst, nerdopolist, mart, richardl, ognarb, david.fontanals, abetts, kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D19311
2019-04-11 17:21:41 +00:00
int entries = 0 ;
m_backAction - > menu ( ) - > clear ( ) ;
for ( int i = urlNavigator - > historyIndex ( ) + 1 ; i < urlNavigator - > historySize ( ) & & entries < MaxNumberOfNavigationentries ; + + i , + + entries ) {
2022-03-18 18:56:20 +00:00
QAction * action = urlNavigatorHistoryAction ( urlNavigator , i , m_backAction - > menu ( ) ) ;
Add navigation history to forward/back buttons
Summary:
Adds navigation history to forward/back buttons in the toolbar. This
changes the forward/back buttons in the toolbar to use the
KToolBarPopupAction class which provides access to a drop down menu.
Test Plan:
Browse some folders
Click the back drop down menu and navigate somewhere
Click the forward drop down menu and navigate somewhere
FEATURE: 157819
FIXED-IN: 19.12.0
Reviewers: #dolphin, ngraham, elvisangelaccio, #vdg
Reviewed By: #dolphin, ngraham, elvisangelaccio, #vdg
Subscribers: felixernst, nerdopolist, mart, richardl, ognarb, david.fontanals, abetts, kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D19311
2019-04-11 17:21:41 +00:00
m_backAction - > menu ( ) - > addAction ( action ) ;
}
}
void DolphinMainWindow : : slotGoBack ( QAction * action )
{
int gotoIndex = action - > data ( ) . value < int > ( ) ;
2020-08-27 16:55:18 +00:00
const KUrlNavigator * urlNavigator = m_activeViewContainer - > urlNavigatorInternalWithHistory ( ) ;
Add navigation history to forward/back buttons
Summary:
Adds navigation history to forward/back buttons in the toolbar. This
changes the forward/back buttons in the toolbar to use the
KToolBarPopupAction class which provides access to a drop down menu.
Test Plan:
Browse some folders
Click the back drop down menu and navigate somewhere
Click the forward drop down menu and navigate somewhere
FEATURE: 157819
FIXED-IN: 19.12.0
Reviewers: #dolphin, ngraham, elvisangelaccio, #vdg
Reviewed By: #dolphin, ngraham, elvisangelaccio, #vdg
Subscribers: felixernst, nerdopolist, mart, richardl, ognarb, david.fontanals, abetts, kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D19311
2019-04-11 17:21:41 +00:00
for ( int i = gotoIndex - urlNavigator - > historyIndex ( ) ; i > 0 ; - - i ) {
goBack ( ) ;
}
}
void DolphinMainWindow : : slotBackForwardActionMiddleClicked ( QAction * action )
{
if ( action ) {
2020-08-27 16:55:18 +00:00
const KUrlNavigator * urlNavigator = activeViewContainer ( ) - > urlNavigatorInternalWithHistory ( ) ;
2020-12-12 13:17:23 +00:00
openNewTab ( urlNavigator - > locationUrl ( action - > data ( ) . value < int > ( ) ) ) ;
Add navigation history to forward/back buttons
Summary:
Adds navigation history to forward/back buttons in the toolbar. This
changes the forward/back buttons in the toolbar to use the
KToolBarPopupAction class which provides access to a drop down menu.
Test Plan:
Browse some folders
Click the back drop down menu and navigate somewhere
Click the forward drop down menu and navigate somewhere
FEATURE: 157819
FIXED-IN: 19.12.0
Reviewers: #dolphin, ngraham, elvisangelaccio, #vdg
Reviewed By: #dolphin, ngraham, elvisangelaccio, #vdg
Subscribers: felixernst, nerdopolist, mart, richardl, ognarb, david.fontanals, abetts, kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D19311
2019-04-11 17:21:41 +00:00
}
}
void DolphinMainWindow : : slotAboutToShowForwardPopupMenu ( )
{
2020-08-27 16:55:18 +00:00
const KUrlNavigator * urlNavigator = m_activeViewContainer - > urlNavigatorInternalWithHistory ( ) ;
Add navigation history to forward/back buttons
Summary:
Adds navigation history to forward/back buttons in the toolbar. This
changes the forward/back buttons in the toolbar to use the
KToolBarPopupAction class which provides access to a drop down menu.
Test Plan:
Browse some folders
Click the back drop down menu and navigate somewhere
Click the forward drop down menu and navigate somewhere
FEATURE: 157819
FIXED-IN: 19.12.0
Reviewers: #dolphin, ngraham, elvisangelaccio, #vdg
Reviewed By: #dolphin, ngraham, elvisangelaccio, #vdg
Subscribers: felixernst, nerdopolist, mart, richardl, ognarb, david.fontanals, abetts, kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D19311
2019-04-11 17:21:41 +00:00
int entries = 0 ;
m_forwardAction - > menu ( ) - > clear ( ) ;
for ( int i = urlNavigator - > historyIndex ( ) - 1 ; i > = 0 & & entries < MaxNumberOfNavigationentries ; - - i , + + entries ) {
2022-03-18 18:56:20 +00:00
QAction * action = urlNavigatorHistoryAction ( urlNavigator , i , m_forwardAction - > menu ( ) ) ;
Add navigation history to forward/back buttons
Summary:
Adds navigation history to forward/back buttons in the toolbar. This
changes the forward/back buttons in the toolbar to use the
KToolBarPopupAction class which provides access to a drop down menu.
Test Plan:
Browse some folders
Click the back drop down menu and navigate somewhere
Click the forward drop down menu and navigate somewhere
FEATURE: 157819
FIXED-IN: 19.12.0
Reviewers: #dolphin, ngraham, elvisangelaccio, #vdg
Reviewed By: #dolphin, ngraham, elvisangelaccio, #vdg
Subscribers: felixernst, nerdopolist, mart, richardl, ognarb, david.fontanals, abetts, kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D19311
2019-04-11 17:21:41 +00:00
m_forwardAction - > menu ( ) - > addAction ( action ) ;
}
}
void DolphinMainWindow : : slotGoForward ( QAction * action )
{
int gotoIndex = action - > data ( ) . value < int > ( ) ;
2020-08-27 16:55:18 +00:00
const KUrlNavigator * urlNavigator = m_activeViewContainer - > urlNavigatorInternalWithHistory ( ) ;
Add navigation history to forward/back buttons
Summary:
Adds navigation history to forward/back buttons in the toolbar. This
changes the forward/back buttons in the toolbar to use the
KToolBarPopupAction class which provides access to a drop down menu.
Test Plan:
Browse some folders
Click the back drop down menu and navigate somewhere
Click the forward drop down menu and navigate somewhere
FEATURE: 157819
FIXED-IN: 19.12.0
Reviewers: #dolphin, ngraham, elvisangelaccio, #vdg
Reviewed By: #dolphin, ngraham, elvisangelaccio, #vdg
Subscribers: felixernst, nerdopolist, mart, richardl, ognarb, david.fontanals, abetts, kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D19311
2019-04-11 17:21:41 +00:00
for ( int i = urlNavigator - > historyIndex ( ) - gotoIndex ; i > 0 ; - - i ) {
goForward ( ) ;
}
}
2022-04-24 11:18:30 +00:00
void DolphinMainWindow : : slotSetSelectionMode ( bool enabled , SelectionMode : : BottomBar : : Contents bottomBarContents )
2021-09-12 13:33:39 +00:00
{
m_activeViewContainer - > setSelectionModeEnabled ( enabled , actionCollection ( ) , bottomBarContents ) ;
}
2007-04-01 18:36:23 +00:00
void DolphinMainWindow : : selectAll ( )
{
clearStatusBar ( ) ;
2007-12-16 19:25:59 +00:00
// if the URL navigator is editable and focused, select the whole
// URL instead of all items of the view
KUrlNavigator * urlNavigator = m_activeViewContainer - > urlNavigator ( ) ;
2018-12-16 12:57:51 +00:00
QLineEdit * lineEdit = urlNavigator - > editor ( ) - > lineEdit ( ) ;
2007-12-16 19:25:59 +00:00
const bool selectUrl = urlNavigator - > isUrlEditable ( ) & &
lineEdit - > hasFocus ( ) ;
if ( selectUrl ) {
lineEdit - > selectAll ( ) ;
} else {
m_activeViewContainer - > view ( ) - > selectAll ( ) ;
}
2007-04-01 18:36:23 +00:00
}
void DolphinMainWindow : : invertSelection ( )
{
clearStatusBar ( ) ;
2007-06-07 21:10:48 +00:00
m_activeViewContainer - > view ( ) - > invertSelection ( ) ;
2007-04-01 18:36:23 +00:00
}
void DolphinMainWindow : : toggleSplitView ( )
{
2014-08-10 16:52:06 +00:00
DolphinTabPage * tabPage = m_tabWidget - > currentTabPage ( ) ;
2021-01-02 17:48:52 +00:00
tabPage - > setSplitViewEnabled ( ! tabPage - > splitViewEnabled ( ) , WithAnimation ) ;
2008-05-04 18:40:06 +00:00
2007-06-07 21:41:22 +00:00
updateViewActions ( ) ;
2007-04-01 18:36:23 +00:00
}
2016-09-26 16:55:42 +00:00
void DolphinMainWindow : : toggleSplitStash ( )
{
DolphinTabPage * tabPage = m_tabWidget - > currentTabPage ( ) ;
2021-01-02 17:48:52 +00:00
tabPage - > setSplitViewEnabled ( false , WithAnimation ) ;
tabPage - > setSplitViewEnabled ( true , WithAnimation , QUrl ( " stash:/ " ) ) ;
2016-09-26 16:55:42 +00:00
}
2021-09-12 13:33:39 +00:00
void DolphinMainWindow : : copyToInactiveSplitView ( )
{
if ( m_activeViewContainer - > view ( ) - > selectedItems ( ) . isEmpty ( ) ) {
2022-04-24 11:18:30 +00:00
m_activeViewContainer - > setSelectionModeEnabled ( true , actionCollection ( ) , SelectionMode : : BottomBar : : Contents : : CopyToOtherViewContents ) ;
2021-09-12 13:33:39 +00:00
} else {
m_tabWidget - > copyToInactiveSplitView ( ) ;
m_activeViewContainer - > setSelectionModeEnabled ( false ) ;
}
}
void DolphinMainWindow : : moveToInactiveSplitView ( )
{
if ( m_activeViewContainer - > view ( ) - > selectedItems ( ) . isEmpty ( ) ) {
2022-04-24 11:18:30 +00:00
m_activeViewContainer - > setSelectionModeEnabled ( true , actionCollection ( ) , SelectionMode : : BottomBar : : Contents : : MoveToOtherViewContents ) ;
2021-09-12 13:33:39 +00:00
} else {
m_tabWidget - > moveToInactiveSplitView ( ) ;
m_activeViewContainer - > setSelectionModeEnabled ( false ) ;
}
}
2007-04-01 18:36:23 +00:00
void DolphinMainWindow : : reloadView ( )
{
clearStatusBar ( ) ;
2016-10-04 15:30:51 +00:00
m_activeViewContainer - > reload ( ) ;
2018-09-19 08:20:14 +00:00
m_activeViewContainer - > statusBar ( ) - > updateSpaceInfo ( ) ;
2007-04-01 18:36:23 +00:00
}
void DolphinMainWindow : : stopLoading ( )
2007-06-12 21:45:22 +00:00
{
2010-09-22 19:39:46 +00:00
m_activeViewContainer - > view ( ) - > stopLoading ( ) ;
}
void DolphinMainWindow : : enableStopAction ( )
{
2016-03-16 21:17:37 +00:00
actionCollection ( ) - > action ( QStringLiteral ( " stop " ) ) - > setEnabled ( true ) ;
2010-09-22 19:39:46 +00:00
}
void DolphinMainWindow : : disableStopAction ( )
{
2016-03-16 21:17:37 +00:00
actionCollection ( ) - > action ( QStringLiteral ( " stop " ) ) - > setEnabled ( false ) ;
2007-06-12 21:45:22 +00:00
}
2007-04-01 18:36:23 +00:00
2021-09-12 13:33:39 +00:00
void DolphinMainWindow : : toggleSelectionMode ( )
{
const bool checked = ! m_activeViewContainer - > isSelectionModeEnabled ( ) ;
2022-04-24 11:18:30 +00:00
m_activeViewContainer - > setSelectionModeEnabled ( checked , actionCollection ( ) , SelectionMode : : BottomBar : : Contents : : GeneralContents ) ;
2021-09-12 13:33:39 +00:00
actionCollection ( ) - > action ( QStringLiteral ( " toggle_selection_mode " ) ) - > setChecked ( checked ) ;
}
2017-03-11 17:33:41 +00:00
void DolphinMainWindow : : showFilterBar ( )
2007-04-01 18:36:23 +00:00
{
2017-03-11 17:33:41 +00:00
m_activeViewContainer - > setFilterBarVisible ( true ) ;
2007-04-01 18:36:23 +00:00
}
2020-12-02 07:07:41 +00:00
void DolphinMainWindow : : toggleFilterBar ( )
{
2020-12-05 15:58:04 +00:00
const bool checked = ! m_activeViewContainer - > isFilterBarVisible ( ) ;
2020-12-02 07:07:41 +00:00
m_activeViewContainer - > setFilterBarVisible ( checked ) ;
QAction * toggleFilterBarAction = actionCollection ( ) - > action ( QStringLiteral ( " toggle_filter " ) ) ;
toggleFilterBarAction - > setChecked ( checked ) ;
}
2007-04-01 18:36:23 +00:00
void DolphinMainWindow : : toggleEditLocation ( )
{
clearStatusBar ( ) ;
2016-03-16 21:17:37 +00:00
QAction * action = actionCollection ( ) - > action ( QStringLiteral ( " editable_location " ) ) ;
2007-06-07 21:10:48 +00:00
KUrlNavigator * urlNavigator = m_activeViewContainer - > urlNavigator ( ) ;
2008-01-28 11:37:08 +00:00
urlNavigator - > setUrlEditable ( action - > isChecked ( ) ) ;
2007-04-01 18:36:23 +00:00
}
2008-10-25 09:41:39 +00:00
void DolphinMainWindow : : replaceLocation ( )
2007-04-01 18:36:23 +00:00
{
2007-11-04 18:50:22 +00:00
KUrlNavigator * navigator = m_activeViewContainer - > urlNavigator ( ) ;
2018-12-16 12:57:51 +00:00
QLineEdit * lineEdit = navigator - > editor ( ) - > lineEdit ( ) ;
Return editable URL navigator to breadcrumb mode if it has focus and everything is selected and when Ctrl+L is pressed
Summary:
This patch makes an editable location bar return to breadcrumb mode when {key Ctrl L} is pressed, but only if the location bar currently has focus and everything is selected. Otherwise, it will simply return focus to it as before.
This provides a slightly easier way to make the location bar return to breadcrumbs mode
Test Plan:
- Compile and deploy and make the location bar be breadcrumbs
- Hit {key Ctrl L} twice in a row -> location field turns to being in breadcrumb mode. Focus is correctly returned to the main view.
- Hit {key Ctrl L}, move focus elsewhere, then hit {key Ctrl L} again -> Location bar is editable and focused with everything selected.
- Hit {key Ctrl L}, deselect some of the text, then hit {key Ctrl L} again -> Location bar selects everything.
Reviewers: #dolphin, elvisangelaccio, dhaumann
Reviewed By: elvisangelaccio, dhaumann
Subscribers: elvisangelaccio, dhaumann, kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D16980
2018-12-16 20:49:57 +00:00
// If the text field currently has focus and everything is selected,
// pressing the keyboard shortcut returns the whole thing to breadcrumb mode
if ( navigator - > isUrlEditable ( )
& & lineEdit - > hasFocus ( )
& & lineEdit - > selectedText ( ) = = lineEdit - > text ( ) ) {
navigator - > setUrlEditable ( false ) ;
} else {
navigator - > setUrlEditable ( true ) ;
navigator - > setFocus ( ) ;
lineEdit - > selectAll ( ) ;
}
2007-04-01 18:36:23 +00:00
}
2010-12-31 10:59:46 +00:00
void DolphinMainWindow : : togglePanelLockState ( )
{
2011-11-06 10:58:48 +00:00
const bool newLockState = ! GeneralSettings : : lockPanels ( ) ;
2020-10-23 17:48:22 +00:00
const auto childrenObjects = children ( ) ;
for ( QObject * child : childrenObjects ) {
2010-12-31 10:59:46 +00:00
DolphinDockWidget * dock = qobject_cast < DolphinDockWidget * > ( child ) ;
2011-02-09 18:21:58 +00:00
if ( dock ) {
2010-12-31 10:59:46 +00:00
dock - > setLocked ( newLockState ) ;
}
}
2022-01-28 18:40:11 +00:00
DolphinPlacesModelSingleton : : instance ( ) . placesModel ( ) - > setPanelsLocked ( newLockState ) ;
2011-11-06 10:58:48 +00:00
GeneralSettings : : setLockPanels ( newLockState ) ;
2010-12-31 10:59:46 +00:00
}
2018-01-18 17:49:54 +00:00
void DolphinMainWindow : : slotTerminalPanelVisibilityChanged ( )
{
2019-08-11 11:11:37 +00:00
if ( m_terminalPanel - > isHiddenInVisibleWindow ( ) & & m_activeViewContainer ) {
2018-01-18 17:49:54 +00:00
m_activeViewContainer - > view ( ) - > setFocus ( ) ;
}
}
2007-04-01 18:36:23 +00:00
void DolphinMainWindow : : goBack ( )
{
2020-08-27 16:55:18 +00:00
DolphinUrlNavigator * urlNavigator = m_activeViewContainer - > urlNavigatorInternalWithHistory ( ) ;
2010-07-08 19:46:56 +00:00
urlNavigator - > goBack ( ) ;
2010-11-05 17:02:58 +00:00
2010-07-08 19:46:56 +00:00
if ( urlNavigator - > locationState ( ) . isEmpty ( ) ) {
// An empty location state indicates a redirection URL,
// which must be skipped too
2010-11-05 17:02:58 +00:00
urlNavigator - > goBack ( ) ;
2010-07-08 19:46:56 +00:00
}
2007-04-01 18:36:23 +00:00
}
void DolphinMainWindow : : goForward ( )
{
2020-11-05 15:28:13 +00:00
m_activeViewContainer - > urlNavigatorInternalWithHistory ( ) - > goForward ( ) ;
2007-04-01 18:36:23 +00:00
}
void DolphinMainWindow : : goUp ( )
{
2020-11-05 15:28:13 +00:00
m_activeViewContainer - > urlNavigatorInternalWithHistory ( ) - > goUp ( ) ;
2007-04-01 18:36:23 +00:00
}
2011-03-29 16:35:50 +00:00
void DolphinMainWindow : : goHome ( )
{
2020-11-05 15:28:13 +00:00
m_activeViewContainer - > urlNavigatorInternalWithHistory ( ) - > goHome ( ) ;
2011-03-29 16:35:50 +00:00
}
2017-08-24 13:45:28 +00:00
void DolphinMainWindow : : goBackInNewTab ( )
2009-11-09 17:50:21 +00:00
{
2020-11-05 22:30:07 +00:00
const KUrlNavigator * urlNavigator = activeViewContainer ( ) - > urlNavigatorInternalWithHistory ( ) ;
2017-08-24 13:45:28 +00:00
const int index = urlNavigator - > historyIndex ( ) + 1 ;
2020-12-12 13:17:23 +00:00
openNewTab ( urlNavigator - > locationUrl ( index ) ) ;
2009-11-09 17:50:21 +00:00
}
2017-08-24 13:45:28 +00:00
void DolphinMainWindow : : goForwardInNewTab ( )
2009-11-09 17:50:21 +00:00
{
2020-11-05 22:30:07 +00:00
const KUrlNavigator * urlNavigator = activeViewContainer ( ) - > urlNavigatorInternalWithHistory ( ) ;
2017-08-24 13:45:28 +00:00
const int index = urlNavigator - > historyIndex ( ) - 1 ;
2020-12-12 13:17:23 +00:00
openNewTab ( urlNavigator - > locationUrl ( index ) ) ;
2009-11-09 17:50:21 +00:00
}
2017-08-24 13:45:28 +00:00
void DolphinMainWindow : : goUpInNewTab ( )
2009-11-09 17:50:21 +00:00
{
2017-08-24 13:45:28 +00:00
const QUrl currentUrl = activeViewContainer ( ) - > urlNavigator ( ) - > locationUrl ( ) ;
2020-12-12 13:17:23 +00:00
openNewTab ( KIO : : upUrl ( currentUrl ) ) ;
2009-11-09 17:50:21 +00:00
}
2017-08-24 13:45:28 +00:00
void DolphinMainWindow : : goHomeInNewTab ( )
2012-01-09 05:54:57 +00:00
{
2020-12-12 13:17:23 +00:00
openNewTab ( Dolphin : : homeUrl ( ) ) ;
2012-01-09 05:54:57 +00:00
}
2007-04-01 18:36:23 +00:00
void DolphinMainWindow : : compareFiles ( )
{
2014-08-10 16:52:06 +00:00
const KFileItemList items = m_tabWidget - > currentTabPage ( ) - > selectedItems ( ) ;
2013-10-13 08:55:21 +00:00
if ( items . count ( ) ! = 2 ) {
// The action is disabled in this case, but it could have been triggered
// via D-Bus, see https://bugs.kde.org/show_bug.cgi?id=325517
return ;
2007-04-09 19:12:54 +00:00
}
2007-04-01 18:36:23 +00:00
2014-10-21 19:18:43 +00:00
QUrl urlA = items . at ( 0 ) . url ( ) ;
QUrl urlB = items . at ( 1 ) . url ( ) ;
2007-04-01 18:36:23 +00:00
2016-03-16 21:17:37 +00:00
QString command ( QStringLiteral ( " kompare -c \" " ) ) ;
2014-10-21 19:18:43 +00:00
command . append ( urlA . toDisplayString ( QUrl : : PreferLocalFile ) ) ;
2007-04-01 18:36:23 +00:00
command . append ( " \" \" " ) ;
2014-10-21 19:18:43 +00:00
command . append ( urlB . toDisplayString ( QUrl : : PreferLocalFile ) ) ;
2007-04-01 18:36:23 +00:00
command . append ( ' \" ' ) ;
2020-04-05 11:44:12 +00:00
KIO : : CommandLauncherJob * job = new KIO : : CommandLauncherJob ( command , this ) ;
job - > setDesktopName ( QStringLiteral ( " org.kde.kompare " ) ) ;
job - > start ( ) ;
2007-04-01 18:36:23 +00:00
}
2007-11-18 14:37:57 +00:00
void DolphinMainWindow : : toggleShowMenuBar ( )
{
const bool visible = menuBar ( ) - > isVisible ( ) ;
menuBar ( ) - > setVisible ( ! visible ) ;
}
2019-11-17 17:14:27 +00:00
QPointer < QAction > DolphinMainWindow : : preferredSearchTool ( )
{
m_searchTools . clear ( ) ;
KMoreToolsMenuFactory ( " dolphin/search-tools " ) . fillMenuFromGroupingNames (
2020-05-05 10:05:18 +00:00
& m_searchTools , { " files-find " } , m_activeViewContainer - > url ( )
2019-11-17 17:14:27 +00:00
) ;
QList < QAction * > actions = m_searchTools . actions ( ) ;
if ( actions . isEmpty ( ) ) {
return nullptr ;
}
QAction * action = actions . first ( ) ;
if ( action - > isSeparator ( ) ) {
return nullptr ;
}
return action ;
}
void DolphinMainWindow : : updateOpenPreferredSearchToolAction ( )
{
QAction * openPreferredSearchTool = actionCollection ( ) - > action ( QStringLiteral ( " open_preferred_search_tool " ) ) ;
if ( ! openPreferredSearchTool ) {
return ;
}
QPointer < QAction > tool = preferredSearchTool ( ) ;
if ( tool ) {
openPreferredSearchTool - > setVisible ( true ) ;
openPreferredSearchTool - > setText ( i18nc ( " @action:inmenu Tools " , " Open %1 " , tool - > text ( ) ) ) ;
2021-09-22 18:52:52 +00:00
// Only override with the app icon if it is the default, i.e. the user hasn't configured one manually
// https://bugs.kde.org/show_bug.cgi?id=442815
if ( openPreferredSearchTool - > icon ( ) . name ( ) = = QLatin1String ( " search " ) ) {
openPreferredSearchTool - > setIcon ( tool - > icon ( ) ) ;
}
2019-11-17 17:14:27 +00:00
} else {
openPreferredSearchTool - > setVisible ( false ) ;
// still visible in Shortcuts configuration window
openPreferredSearchTool - > setText ( i18nc ( " @action:inmenu Tools " , " Open Preferred Search Tool " ) ) ;
openPreferredSearchTool - > setIcon ( QIcon : : fromTheme ( QStringLiteral ( " search " ) ) ) ;
}
}
void DolphinMainWindow : : openPreferredSearchTool ( )
{
QPointer < QAction > tool = preferredSearchTool ( ) ;
if ( tool ) {
tool - > trigger ( ) ;
}
}
void DolphinMainWindow : : openTerminal ( )
{
2022-05-02 20:25:24 +00:00
openTerminalJob ( m_activeViewContainer - > url ( ) ) ;
}
void DolphinMainWindow : : openTerminalHere ( )
{
QList < QUrl > urls = { } ;
for ( const KFileItem & item : m_activeViewContainer - > view ( ) - > selectedItems ( ) ) {
2022-05-29 10:11:08 +00:00
QUrl url = item . targetUrl ( ) ;
2022-05-02 20:25:24 +00:00
if ( item . isFile ( ) ) {
url . setPath ( QFileInfo ( url . path ( ) ) . absolutePath ( ) ) ;
}
if ( ! urls . contains ( url ) ) {
urls < < url ;
}
}
// No items are selected. Open a terminal window for the current location.
if ( urls . count ( ) = = 0 ) {
openTerminal ( ) ;
return ;
}
2020-09-14 14:01:47 +00:00
2022-05-02 20:25:24 +00:00
if ( urls . count ( ) > 5 ) {
QString question = i18np ( " Are you sure you want to open 1 terminal window? " ,
" Are you sure you want to open %1 terminal windows? " , urls . count ( ) ) ;
2022-09-30 17:56:52 +00:00
# if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
const int answer = KMessageBox : : warningTwoActions ( this , question , { } ,
# else
2022-07-03 16:59:27 +00:00
const int answer = KMessageBox : : warningYesNo ( this , question , { } ,
2022-09-30 17:56:52 +00:00
# endif
2022-07-03 16:59:27 +00:00
KGuiItem ( i18ncp ( " @action:button " , " Open %1 Terminal " , " Open %1 Terminals " , urls . count ( ) ) ,
QStringLiteral ( " utilities-terminal " ) ) ,
KStandardGuiItem : : cancel ( ) ) ;
2022-09-30 17:56:52 +00:00
# if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
if ( answer ! = KMessageBox : : PrimaryAction ) {
# else
2022-05-02 20:25:24 +00:00
if ( answer ! = KMessageBox : : Yes ) {
2022-09-30 17:56:52 +00:00
# endif
2022-05-02 20:25:24 +00:00
return ;
}
}
for ( const QUrl & url : urls ) {
openTerminalJob ( url ) ;
}
}
void DolphinMainWindow : : openTerminalJob ( const QUrl & url )
{
2020-09-14 14:01:47 +00:00
if ( url . isLocalFile ( ) ) {
2021-08-31 15:09:14 +00:00
auto job = new KTerminalLauncherJob ( QString ( ) ) ;
job - > setWorkingDirectory ( url . toLocalFile ( ) ) ;
job - > start ( ) ;
2020-09-14 14:01:47 +00:00
return ;
}
// Not a local file, with protocol Class ":local", try stat'ing
if ( KProtocolInfo : : protocolClass ( url . scheme ( ) ) = = QLatin1String ( " :local " ) ) {
KIO : : StatJob * job = KIO : : mostLocalUrl ( url ) ;
KJobWidgets : : setWindow ( job , this ) ;
connect ( job , & KJob : : result , this , [ job ] ( ) {
QUrl statUrl ;
if ( ! job - > error ( ) ) {
statUrl = job - > mostLocalUrl ( ) ;
}
2021-08-31 15:09:14 +00:00
auto job = new KTerminalLauncherJob ( QString ( ) ) ;
job - > setWorkingDirectory ( statUrl . isLocalFile ( ) ? statUrl . toLocalFile ( ) : QDir : : homePath ( ) ) ;
job - > start ( ) ;
2020-09-14 14:01:47 +00:00
} ) ;
return ;
}
// Nothing worked, just use $HOME
2021-08-31 15:09:14 +00:00
auto job = new KTerminalLauncherJob ( QString ( ) ) ;
job - > setWorkingDirectory ( QDir : : homePath ( ) ) ;
job - > start ( ) ;
2009-03-10 06:59:27 +00:00
}
2007-04-01 18:36:23 +00:00
void DolphinMainWindow : : editSettings ( )
{
2011-02-09 18:21:58 +00:00
if ( ! m_settingsDialog ) {
2012-01-30 15:36:40 +00:00
DolphinViewContainer * container = activeViewContainer ( ) ;
container - > view ( ) - > writeSettings ( ) ;
2012-02-23 16:26:51 +00:00
2014-10-21 19:18:43 +00:00
const QUrl url = container - > url ( ) ;
2020-12-26 15:16:06 +00:00
DolphinSettingsDialog * settingsDialog = new DolphinSettingsDialog ( url , this , actionCollection ( ) ) ;
2014-04-10 14:53:41 +00:00
connect ( settingsDialog , & DolphinSettingsDialog : : settingsChanged , this , & DolphinMainWindow : : refreshViews ) ;
2020-11-05 22:30:07 +00:00
connect ( settingsDialog , & DolphinSettingsDialog : : settingsChanged ,
& DolphinUrlNavigatorsController : : slotReadSettings ) ;
2011-04-12 18:01:31 +00:00
settingsDialog - > setAttribute ( Qt : : WA_DeleteOnClose ) ;
settingsDialog - > show ( ) ;
m_settingsDialog = settingsDialog ;
2009-01-13 18:06:15 +00:00
} else {
2011-04-12 18:01:31 +00:00
m_settingsDialog . data ( ) - > raise ( ) ;
2009-01-13 18:06:15 +00:00
}
2007-04-01 18:36:23 +00:00
}
2014-10-21 19:18:43 +00:00
void DolphinMainWindow : : handleUrl ( const QUrl & url )
2010-01-25 07:58:24 +00:00
{
2020-08-18 08:43:58 +00:00
delete m_lastHandleUrlOpenJob ;
m_lastHandleUrlOpenJob = nullptr ;
2010-03-15 09:55:51 +00:00
if ( url . isLocalFile ( ) & & QFileInfo ( url . toLocalFile ( ) ) . isDir ( ) ) {
activeViewContainer ( ) - > setUrl ( url ) ;
2010-01-25 07:58:24 +00:00
} else {
2020-08-18 08:43:58 +00:00
m_lastHandleUrlOpenJob = new KIO : : OpenUrlJob ( url ) ;
2022-10-11 06:46:12 +00:00
# if KIO_VERSION >= QT_VERSION_CHECK(5, 98, 0)
m_lastHandleUrlOpenJob - > setUiDelegate ( KIO : : createDefaultJobUiDelegate ( KJobUiDelegate : : AutoHandlingEnabled , this ) ) ;
# else
2020-08-18 08:43:58 +00:00
m_lastHandleUrlOpenJob - > setUiDelegate ( new KIO : : JobUiDelegate ( KJobUiDelegate : : AutoHandlingEnabled , this ) ) ;
2022-10-11 06:46:12 +00:00
# endif
2020-12-14 22:40:12 +00:00
m_lastHandleUrlOpenJob - > setShowOpenOrExecuteDialog ( true ) ;
2020-08-18 08:43:58 +00:00
connect ( m_lastHandleUrlOpenJob , & KIO : : OpenUrlJob : : mimeTypeFound , this ,
[ this , url ] ( const QString & mimetype ) {
if ( mimetype = = QLatin1String ( " inode/directory " ) ) {
// If it's a dir, we'll take it from here
m_lastHandleUrlOpenJob - > kill ( ) ;
m_lastHandleUrlOpenJob = nullptr ;
activeViewContainer ( ) - > setUrl ( url ) ;
}
} ) ;
connect ( m_lastHandleUrlOpenJob , & KIO : : OpenUrlJob : : result , this , [ this ] ( ) {
m_lastHandleUrlOpenJob = nullptr ;
} ) ;
m_lastHandleUrlOpenJob - > start ( ) ;
2010-01-25 07:58:24 +00:00
}
}
void DolphinMainWindow : : slotWriteStateChanged ( bool isFolderWritable )
{
2018-10-07 11:19:17 +00:00
// trash:/ is writable but we don't want to create new items in it.
// TODO: remove the trash check once https://phabricator.kde.org/T8234 is implemented
newFileMenu ( ) - > setEnabled ( isFolderWritable & & m_activeViewContainer - > url ( ) . scheme ( ) ! = QLatin1String ( " trash " ) ) ;
2010-01-25 07:58:24 +00:00
}
2011-10-08 19:40:34 +00:00
void DolphinMainWindow : : openContextMenu ( const QPoint & pos ,
const KFileItem & item ,
2022-04-02 17:00:58 +00:00
const KFileItemList & selectedItems ,
const QUrl & url )
2010-01-25 07:58:24 +00:00
{
2022-04-02 17:00:58 +00:00
QPointer < DolphinContextMenu > contextMenu = new DolphinContextMenu ( this , item , selectedItems , url , & m_fileItemActions ) ;
contextMenu . data ( ) - > exec ( pos ) ;
2015-01-29 12:45:14 +00:00
// Delete the menu, unless it has been deleted in its own nested event loop already.
if ( contextMenu ) {
contextMenu - > deleteLater ( ) ;
}
2010-01-25 07:58:24 +00:00
}
2022-01-28 19:02:49 +00:00
QMenu * DolphinMainWindow : : createPopupMenu ( )
{
QMenu * menu = KXmlGuiWindow : : createPopupMenu ( ) ;
menu - > addSeparator ( ) ;
menu - > addAction ( actionCollection ( ) - > action ( QStringLiteral ( " lock_panels " ) ) ) ;
return menu ;
}
2021-04-29 13:22:10 +00:00
void DolphinMainWindow : : updateHamburgerMenu ( )
2011-03-26 22:22:21 +00:00
{
KActionCollection * ac = actionCollection ( ) ;
2021-04-29 13:22:10 +00:00
auto hamburgerMenu = static_cast < KHamburgerMenu * > (
ac - > action ( KStandardAction : : name ( KStandardAction : : HamburgerMenu ) ) ) ;
auto menu = hamburgerMenu - > menu ( ) ;
if ( ! menu ) {
menu = new QMenu ( this ) ;
hamburgerMenu - > setMenu ( menu ) ;
2021-05-13 16:49:27 +00:00
hamburgerMenu - > hideActionsOf ( ac - > action ( QStringLiteral ( " basic_actions " ) ) - > menu ( ) ) ;
hamburgerMenu - > hideActionsOf ( ac - > action ( QStringLiteral ( " zoom " ) ) - > menu ( ) ) ;
2021-04-29 13:22:10 +00:00
} else {
menu - > clear ( ) ;
}
2021-05-13 16:49:27 +00:00
const QList < QAction * > toolbarActions = toolBar ( ) - > actions ( ) ;
2011-03-26 22:22:21 +00:00
2021-05-13 16:49:27 +00:00
if ( ! toolBar ( ) - > isVisible ( ) ) {
// If neither the menu bar nor the toolbar are visible, these actions should be available.
menu - > addAction ( ac - > action ( KStandardAction : : name ( KStandardAction : : ShowMenubar ) ) ) ;
menu - > addAction ( toolBarMenuAction ( ) ) ;
2011-03-26 22:22:21 +00:00
menu - > addSeparator ( ) ;
}
2021-05-13 16:49:27 +00:00
// This group of actions (until the next separator) contains all the most basic actions
// necessary to use Dolphin effectively.
menu - > addAction ( ac - > action ( QStringLiteral ( " go_back " ) ) ) ;
menu - > addAction ( ac - > action ( QStringLiteral ( " go_forward " ) ) ) ;
Clean up hamburger menu and viewport and single-folder context menus
Summary:
Dolphin's hamburger and context menus have grown organically over time,
becoming a bit messy and somewhat visually overwhelming. This makes them
harder to parse and more intimidating to use.
This patch cleans up the hamburger menu and viewport and single-folder context
menus to group items more logically, and remove items that aren't actually relevant
to the context.
The hamburger menu part of the patch is fairly significant, and draws from the
principle of only showing actions with a global scope that are not already accessible
from another visible method (e.g. via the default toolbar). In the end, it manages to be
shorter than the current hamburger menu with expose actions that are more relevant.
A visible method to display context-specific actions should be explored separately
(see https://bugs.kde.org/show_bug.cgi?id=411500).
Depends on D23945
Test Plan:
Before, hamburger menu: {F7334178}
After, hamburger menu: {F7350958}
Before, viewport: {F7324802}
After, viewport: {F7330109}
Before, one folder selected: {F7324798}
After, one folder selected: {F7341163}
No change for the context menus shown when selecting a single item, multiple items, or multiple folders
Reviewers: #vdg, #dolphin, meven, elvisangelaccio, GB_2
Reviewed By: #vdg, #dolphin, meven, elvisangelaccio, GB_2
Subscribers: GB_2, mmustac, elvisangelaccio, meven, ndavis, kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D23757
2019-09-06 16:08:58 +00:00
2021-05-13 16:49:27 +00:00
menu - > addMenu ( m_newFileMenu - > menu ( ) ) ;
2021-09-12 13:33:39 +00:00
if ( ! toolBar ( ) - > isVisible ( )
2022-04-24 00:34:43 +00:00
| | ! toolbarActions . contains ( ac - > action ( QStringLiteral ( " toggle_selection_mode_tool_bar " ) ) )
2021-09-12 13:33:39 +00:00
) {
menu - > addAction ( ac - > action ( QStringLiteral ( " toggle_selection_mode " ) ) ) ;
}
2021-05-13 16:49:27 +00:00
menu - > addAction ( ac - > action ( QStringLiteral ( " basic_actions " ) ) ) ;
menu - > addAction ( ac - > action ( KStandardAction : : name ( KStandardAction : : Undo ) ) ) ;
if ( ! toolBar ( ) - > isVisible ( )
| | ( ! toolbarActions . contains ( ac - > action ( QStringLiteral ( " toggle_search " ) ) )
& & ! toolbarActions . contains ( ac - > action ( QStringLiteral ( " open_preferred_search_tool " ) ) ) )
) {
menu - > addAction ( ac - > action ( KStandardAction : : name ( KStandardAction : : Find ) ) ) ;
// This way a search action will only be added if none of the three available
// search actions is present on the toolbar.
}
if ( ! toolBar ( ) - > isVisible ( )
| | ! toolbarActions . contains ( ac - > action ( QStringLiteral ( " toggle_filter " ) ) )
) {
menu - > addAction ( ac - > action ( QStringLiteral ( " show_filter_bar " ) ) ) ;
// This way a filter action will only be added if none of the two available
// filter actions is present on the toolbar.
}
2021-04-29 13:22:10 +00:00
menu - > addSeparator ( ) ;
2011-03-26 22:22:21 +00:00
2021-05-13 16:49:27 +00:00
// The second group of actions (up until the next separator) contains actions for opening
// additional views to interact with the file system.
menu - > addAction ( ac - > action ( QStringLiteral ( " file_new " ) ) ) ;
menu - > addAction ( ac - > action ( QStringLiteral ( " new_tab " ) ) ) ;
if ( ac - > action ( QStringLiteral ( " undo_close_tab " ) ) - > isEnabled ( ) ) {
menu - > addAction ( ac - > action ( QStringLiteral ( " closed_tabs " ) ) ) ;
}
2021-04-29 13:22:10 +00:00
menu - > addAction ( ac - > action ( QStringLiteral ( " open_terminal " ) ) ) ;
2011-03-26 22:22:21 +00:00
menu - > addSeparator ( ) ;
2021-05-13 16:49:27 +00:00
// The third group contains actions to change what one sees in the view
// and to change the more general UI.
if ( ! toolBar ( ) - > isVisible ( )
| | ( ! toolbarActions . contains ( ac - > action ( QStringLiteral ( " icons " ) ) )
& & ! toolbarActions . contains ( ac - > action ( QStringLiteral ( " compact " ) ) )
& & ! toolbarActions . contains ( ac - > action ( QStringLiteral ( " details " ) ) )
& & ! toolbarActions . contains ( ac - > action ( QStringLiteral ( " view_mode " ) ) ) )
) {
menu - > addAction ( ac - > action ( QStringLiteral ( " view_mode " ) ) ) ;
}
menu - > addAction ( ac - > action ( QStringLiteral ( " show_hidden_files " ) ) ) ;
2021-06-08 11:48:41 +00:00
menu - > addAction ( ac - > action ( QStringLiteral ( " sort " ) ) ) ;
2021-05-13 16:49:27 +00:00
menu - > addAction ( ac - > action ( QStringLiteral ( " additional_info " ) ) ) ;
if ( ! GeneralSettings : : showStatusBar ( ) | | ! GeneralSettings : : showZoomSlider ( ) ) {
menu - > addAction ( ac - > action ( QStringLiteral ( " zoom " ) ) ) ;
}
2021-04-29 13:22:10 +00:00
menu - > addAction ( ac - > action ( QStringLiteral ( " panels " ) ) ) ;
2011-03-26 22:22:21 +00:00
2021-05-13 16:49:27 +00:00
// The "Configure" menu is not added to the actionCollection() because there is hardly
// a good reason for users to put it on their toolbar.
auto configureMenu = menu - > addMenu ( QIcon : : fromTheme ( QStringLiteral ( " configure " ) ) ,
i18nc ( " @action:inmenu menu for configure actions " , " Configure " ) ) ;
configureMenu - > addAction ( ac - > action ( KStandardAction : : name ( KStandardAction : : SwitchApplicationLanguage ) ) ) ;
configureMenu - > addAction ( ac - > action ( KStandardAction : : name ( KStandardAction : : KeyBindings ) ) ) ;
configureMenu - > addAction ( ac - > action ( KStandardAction : : name ( KStandardAction : : ConfigureToolbars ) ) ) ;
configureMenu - > addAction ( ac - > action ( KStandardAction : : name ( KStandardAction : : Preferences ) ) ) ;
hamburgerMenu - > hideActionsOf ( configureMenu ) ;
2011-03-26 22:22:21 +00:00
}
2014-10-21 19:18:43 +00:00
void DolphinMainWindow : : slotPlaceActivated ( const QUrl & url )
2013-10-26 07:24:04 +00:00
{
DolphinViewContainer * view = activeViewContainer ( ) ;
if ( view - > url ( ) = = url ) {
2023-01-24 17:04:54 +00:00
view - > clearFilterBar ( ) ; // Fixes bug 259382.
2013-10-26 07:24:04 +00:00
// We can end up here if the user clicked a device in the Places Panel
// which had been unmounted earlier, see https://bugs.kde.org/show_bug.cgi?id=161385.
reloadView ( ) ;
} else {
2020-11-08 07:21:56 +00:00
view - > disableUrlNavigatorSelectionRequests ( ) ;
2013-10-26 07:24:04 +00:00
changeUrl ( url ) ;
2020-11-08 07:21:56 +00:00
view - > enableUrlNavigatorSelectionRequests ( ) ;
2013-10-26 07:24:04 +00:00
}
}
2014-07-22 12:01:49 +00:00
void DolphinMainWindow : : closedTabsCountChanged ( unsigned int count )
{
2016-03-16 21:17:37 +00:00
actionCollection ( ) - > action ( QStringLiteral ( " undo_close_tab " ) ) - > setEnabled ( count > 0 ) ;
2014-07-22 12:01:49 +00:00
}
2014-08-10 16:52:06 +00:00
void DolphinMainWindow : : activeViewChanged ( DolphinViewContainer * viewContainer )
2007-06-12 21:45:22 +00:00
{
2014-08-10 16:52:06 +00:00
DolphinViewContainer * oldViewContainer = m_activeViewContainer ;
2011-02-09 18:21:58 +00:00
Q_ASSERT ( viewContainer ) ;
2007-06-12 21:45:22 +00:00
2008-02-11 12:34:48 +00:00
m_activeViewContainer = viewContainer ;
2014-08-10 16:52:06 +00:00
if ( oldViewContainer ) {
[dolphin] Add an action to toggle the searchbar
Summary:
Make search action toggle the searchbar instead of just launching it.
The search action in dolphin did only bring up the search bar, but to close it again you had to go to the closing button on the same searchbar.
This behavior in inconsistent with other dolphin actions which toggle panels or tools.
BEFORE:
{F7256652}
AFTER:
{F7256862}
BUG: 344617
FIXED-IN: 19.12.0
Closes T8473
Depends on D23075
Test Plan:
- Enable the search mode: the searchbar appears and the toolbar button gets checked
- Press the search button again, and it goes back to normal mode.
- The search button state is coherent with the searchbox
- Coherence is kept when changing to a split view or different tab
- Shorcut <Ctrl-F> does not close the searchbar, but moves the focus to it.
Reviewers: #dolphin, ngraham, #vdg, elvisangelaccio
Reviewed By: ngraham, #vdg
Subscribers: ndavis, felixernst, elvisangelaccio, kfm-devel
Tags: #dolphin
Maniphest Tasks: T8473
Differential Revision: https://phabricator.kde.org/D23232
2019-09-01 19:59:43 +00:00
const QAction * toggleSearchAction = actionCollection ( ) - > action ( QStringLiteral ( " toggle_search " ) ) ;
toggleSearchAction - > disconnect ( oldViewContainer ) ;
2014-08-10 16:52:06 +00:00
// Disconnect all signals between the old view container (container,
// view and url navigator) and main window.
oldViewContainer - > disconnect ( this ) ;
oldViewContainer - > view ( ) - > disconnect ( this ) ;
2021-05-17 12:52:45 +00:00
oldViewContainer - > urlNavigatorInternalWithHistory ( ) - > disconnect ( this ) ;
2020-09-20 16:53:59 +00:00
auto navigators = static_cast < DolphinNavigatorsWidgetAction * >
( actionCollection ( ) - > action ( QStringLiteral ( " url_navigators " ) ) ) ;
navigators - > primaryUrlNavigator ( ) - > disconnect ( this ) ;
if ( auto secondaryUrlNavigator = navigators - > secondaryUrlNavigator ( ) ) {
secondaryUrlNavigator - > disconnect ( this ) ;
2020-06-14 14:20:02 +00:00
}
2019-03-24 17:37:10 +00:00
// except the requestItemInfo so that on hover the information panel can still be updated
connect ( oldViewContainer - > view ( ) , & DolphinView : : requestItemInfo ,
this , & DolphinMainWindow : : requestItemInfo ) ;
2022-09-15 13:36:05 +00:00
// Disconnect other slots.
disconnect ( nullptr , & DolphinViewContainer : : selectionModeChanged ,
actionCollection ( ) - > action ( QStringLiteral ( " toggle_selection_mode " ) ) , & QAction : : setChecked ) ;
2014-08-10 16:52:06 +00:00
}
connectViewSignals ( viewContainer ) ;
2008-03-12 16:58:11 +00:00
m_actionHandler - > setCurrentView ( viewContainer - > view ( ) ) ;
2007-06-12 21:45:22 +00:00
updateHistory ( ) ;
2019-09-01 21:01:57 +00:00
updateFileAndEditActions ( ) ;
2014-04-30 07:34:32 +00:00
updatePasteAction ( ) ;
2007-06-12 21:45:22 +00:00
updateViewActions ( ) ;
updateGoActions ( ) ;
[dolphin] Add an action to toggle the searchbar
Summary:
Make search action toggle the searchbar instead of just launching it.
The search action in dolphin did only bring up the search bar, but to close it again you had to go to the closing button on the same searchbar.
This behavior in inconsistent with other dolphin actions which toggle panels or tools.
BEFORE:
{F7256652}
AFTER:
{F7256862}
BUG: 344617
FIXED-IN: 19.12.0
Closes T8473
Depends on D23075
Test Plan:
- Enable the search mode: the searchbar appears and the toolbar button gets checked
- Press the search button again, and it goes back to normal mode.
- The search button state is coherent with the searchbox
- Coherence is kept when changing to a split view or different tab
- Shorcut <Ctrl-F> does not close the searchbar, but moves the focus to it.
Reviewers: #dolphin, ngraham, #vdg, elvisangelaccio
Reviewed By: ngraham, #vdg
Subscribers: ndavis, felixernst, elvisangelaccio, kfm-devel
Tags: #dolphin
Maniphest Tasks: T8473
Differential Revision: https://phabricator.kde.org/D23232
2019-09-01 19:59:43 +00:00
updateSearchAction ( ) ;
2007-06-12 21:45:22 +00:00
2014-10-21 19:18:43 +00:00
const QUrl url = viewContainer - > url ( ) ;
2020-10-23 17:51:33 +00:00
Q_EMIT urlChanged ( url ) ;
2007-06-12 21:45:22 +00:00
}
2014-08-10 16:52:06 +00:00
void DolphinMainWindow : : tabCountChanged ( int count )
{
const bool enableTabActions = ( count > 1 ) ;
2019-10-13 14:37:00 +00:00
for ( int i = 0 ; i < MaxActivateTabShortcuts ; + + i ) {
actionCollection ( ) - > action ( QStringLiteral ( " activate_tab_%1 " ) . arg ( i ) ) - > setEnabled ( enableTabActions ) ;
}
actionCollection ( ) - > action ( QStringLiteral ( " activate_last_tab " ) ) - > setEnabled ( enableTabActions ) ;
2016-03-16 21:17:37 +00:00
actionCollection ( ) - > action ( QStringLiteral ( " activate_next_tab " ) ) - > setEnabled ( enableTabActions ) ;
actionCollection ( ) - > action ( QStringLiteral ( " activate_prev_tab " ) ) - > setEnabled ( enableTabActions ) ;
2014-08-10 16:52:06 +00:00
}
2018-07-28 15:29:00 +00:00
void DolphinMainWindow : : updateWindowTitle ( )
2014-08-13 20:06:28 +00:00
{
Do not display full path in the title of the tab
Summary:
Displays the full path only in the window title, not in the tab title.
Screenshot for comparison: ( Dolphin on the right is without D28815 , Dolphin on left has both D28815 and this patch)
{F8240079}
Reviewers: #vdg, #dolphin, ngraham, meven
Reviewed By: #vdg, #dolphin, ngraham, meven
Subscribers: ngraham, elvisangelaccio, meven, kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D28857
2020-04-15 15:29:17 +00:00
const QString newTitle = m_activeViewContainer - > captionWindowTitle ( ) ;
2019-01-14 01:55:07 +00:00
if ( windowTitle ( ) ! = newTitle ) {
setWindowTitle ( newTitle ) ;
}
2014-08-13 20:06:28 +00:00
}
2017-10-12 21:17:51 +00:00
void DolphinMainWindow : : slotStorageTearDownFromPlacesRequested ( const QString & mountPath )
{
2020-10-13 17:51:59 +00:00
connect ( m_placesPanel , & PlacesPanel : : storageTearDownSuccessful , this , [ this , mountPath ] ( ) {
setViewsToHomeIfMountPathOpen ( mountPath ) ;
} ) ;
2019-10-01 20:28:20 +00:00
if ( m_terminalPanel & & m_terminalPanel - > currentWorkingDirectory ( ) . startsWith ( mountPath ) ) {
2017-10-12 21:17:51 +00:00
m_tearDownFromPlacesRequested = true ;
m_terminalPanel - > goHome ( ) ;
// m_placesPanel->proceedWithTearDown() will be called in slotTerminalDirectoryChanged
} else {
m_placesPanel - > proceedWithTearDown ( ) ;
}
}
void DolphinMainWindow : : slotStorageTearDownExternallyRequested ( const QString & mountPath )
{
2020-10-13 17:51:59 +00:00
connect ( m_placesPanel , & PlacesPanel : : storageTearDownSuccessful , this , [ this , mountPath ] ( ) {
setViewsToHomeIfMountPathOpen ( mountPath ) ;
} ) ;
2019-10-01 20:28:20 +00:00
if ( m_terminalPanel & & m_terminalPanel - > currentWorkingDirectory ( ) . startsWith ( mountPath ) ) {
2017-10-12 21:17:51 +00:00
m_tearDownFromPlacesRequested = false ;
m_terminalPanel - > goHome ( ) ;
}
2017-10-14 10:49:29 +00:00
}
2017-10-12 21:17:51 +00:00
2022-01-25 17:33:01 +00:00
void DolphinMainWindow : : slotKeyBindings ( )
{
KShortcutsDialog dialog ( KShortcutsEditor : : AllActions , KShortcutsEditor : : LetterShortcutsAllowed , this ) ;
dialog . addCollection ( actionCollection ( ) ) ;
if ( m_terminalPanel ) {
KActionCollection * konsolePartActionCollection = m_terminalPanel - > actionCollection ( ) ;
if ( konsolePartActionCollection ) {
dialog . addCollection ( konsolePartActionCollection , QStringLiteral ( " KonsolePart " ) ) ;
}
}
dialog . configure ( ) ;
}
2020-10-13 17:51:59 +00:00
void DolphinMainWindow : : setViewsToHomeIfMountPathOpen ( const QString & mountPath )
{
const QVector < DolphinViewContainer * > theViewContainers = viewContainers ( ) ;
for ( DolphinViewContainer * viewContainer : theViewContainers ) {
if ( viewContainer & & viewContainer - > url ( ) . toLocalFile ( ) . startsWith ( mountPath ) ) {
viewContainer - > setUrl ( QUrl : : fromLocalFile ( QDir : : homePath ( ) ) ) ;
}
}
disconnect ( m_placesPanel , & PlacesPanel : : storageTearDownSuccessful , nullptr , nullptr ) ;
}
2007-04-01 18:36:23 +00:00
void DolphinMainWindow : : setupActions ( )
{
2022-06-09 21:23:29 +00:00
auto hamburgerMenuAction = KStandardAction : : hamburgerMenu ( nullptr , nullptr , actionCollection ( ) ) ;
2021-04-29 13:22:10 +00:00
2007-04-01 18:36:23 +00:00
// setup 'File' menu
2013-08-16 18:22:33 +00:00
m_newFileMenu = new DolphinNewFileMenu ( actionCollection ( ) , this ) ;
2014-04-06 01:32:55 +00:00
QMenu * menu = m_newFileMenu - > menu ( ) ;
2008-03-18 22:38:52 +00:00
menu - > setTitle ( i18nc ( " @title:menu Create new folder, file, link, etc. " , " Create New " ) ) ;
2021-05-16 15:25:35 +00:00
menu - > setIcon ( QIcon : : fromTheme ( QStringLiteral ( " list-add " ) ) ) ;
2020-12-06 18:47:07 +00:00
m_newFileMenu - > setPopupMode ( QToolButton : : InstantPopup ) ;
2014-04-10 14:53:41 +00:00
connect ( menu , & QMenu : : aboutToShow ,
this , & DolphinMainWindow : : updateNewMenu ) ;
2007-04-01 18:36:23 +00:00
2018-03-10 19:50:29 +00:00
QAction * newWindow = KStandardAction : : openNew ( this , & DolphinMainWindow : : openNewMainWindow , actionCollection ( ) ) ;
2007-06-30 20:10:50 +00:00
newWindow - > setText ( i18nc ( " @action:inmenu File " , " New &Window " ) ) ;
2019-08-24 14:16:42 +00:00
newWindow - > setToolTip ( i18nc ( " @info " , " Open a new Dolphin window " ) ) ;
2019-06-23 19:19:49 +00:00
newWindow - > setWhatsThis ( xi18nc ( " @info:whatsthis " , " This opens a new "
" window just like this one with the current location and view. "
" <nl/>You can drag and drop items between windows. " ) ) ;
2018-12-19 05:03:16 +00:00
newWindow - > setIcon ( QIcon : : fromTheme ( QStringLiteral ( " window-new " ) ) ) ;
2007-04-01 18:36:23 +00:00
2016-03-16 21:17:37 +00:00
QAction * newTab = actionCollection ( ) - > addAction ( QStringLiteral ( " new_tab " ) ) ;
newTab - > setIcon ( QIcon : : fromTheme ( QStringLiteral ( " tab-new " ) ) ) ;
2008-04-12 15:09:46 +00:00
newTab - > setText ( i18nc ( " @action:inmenu File " , " New Tab " ) ) ;
2019-06-23 19:19:49 +00:00
newTab - > setWhatsThis ( xi18nc ( " @info:whatsthis " , " This opens a new "
" <emphasis>Tab</emphasis> with the current location and view.<nl/> "
" A tab is an additional view within this window. "
" You can drag and drop items between tabs. " ) ) ;
2020-12-09 06:55:44 +00:00
actionCollection ( ) - > setDefaultShortcuts ( newTab , { Qt : : CTRL | Qt : : Key_T , Qt : : CTRL | Qt : : SHIFT | Qt : : Key_N } ) ;
2019-05-05 15:20:44 +00:00
connect ( newTab , & QAction : : triggered , this , & DolphinMainWindow : : openNewActivatedTab ) ;
2008-04-12 15:09:46 +00:00
2019-09-01 21:01:57 +00:00
QAction * addToPlaces = actionCollection ( ) - > addAction ( QStringLiteral ( " add_to_places " ) ) ;
addToPlaces - > setIcon ( QIcon : : fromTheme ( QStringLiteral ( " bookmark-new " ) ) ) ;
2020-01-11 19:52:46 +00:00
addToPlaces - > setText ( i18nc ( " @action:inmenu Add current folder to places " , " Add to Places " ) ) ;
2019-09-02 04:23:53 +00:00
addToPlaces - > setWhatsThis ( xi18nc ( " @info:whatsthis " , " This adds the selected folder "
2019-09-01 21:01:57 +00:00
" to the Places panel. " ) ) ;
connect ( addToPlaces , & QAction : : triggered , this , & DolphinMainWindow : : addToPlaces ) ;
2019-05-05 15:20:44 +00:00
QAction * closeTab = KStandardAction : : close ( m_tabWidget , QOverload < > : : of ( & DolphinTabWidget : : closeTab ) , actionCollection ( ) ) ;
2009-01-11 16:28:42 +00:00
closeTab - > setText ( i18nc ( " @action:inmenu File " , " Close Tab " ) ) ;
2019-06-23 19:19:49 +00:00
closeTab - > setWhatsThis ( i18nc ( " @info:whatsthis " , " This closes the "
" currently viewed tab. If no more tabs are left this window "
" will close instead. " ) ) ;
2008-04-16 20:03:05 +00:00
2019-06-23 19:19:49 +00:00
QAction * quitAction = KStandardAction : : quit ( this , & DolphinMainWindow : : quit , actionCollection ( ) ) ;
quitAction - > setWhatsThis ( i18nc ( " @info:whatsthis quit " , " This closes this window. " ) ) ;
2007-04-01 18:36:23 +00:00
// setup 'Edit' menu
KStandardAction : : undo ( this ,
2017-08-24 15:32:06 +00:00
& DolphinMainWindow : : undo ,
2007-04-01 18:36:23 +00:00
actionCollection ( ) ) ;
2019-06-23 19:19:49 +00:00
// i18n: This will be the last paragraph for the whatsthis for all three:
// Cut, Copy and Paste
const QString cutCopyPastePara = xi18nc ( " @info:whatsthis " , " <para><emphasis>Cut, "
" Copy</emphasis> and <emphasis>Paste</emphasis> work between many "
" applications and are among the most used commands. That's why their "
" <emphasis>keyboard shortcuts</emphasis> are prominently placed right "
" next to each other on the keyboard: <shortcut>Ctrl+X</shortcut>, "
" <shortcut>Ctrl+C</shortcut> and <shortcut>Ctrl+V</shortcut>.</para> " ) ;
QAction * cutAction = KStandardAction : : cut ( this , & DolphinMainWindow : : cut , actionCollection ( ) ) ;
2022-04-24 11:18:30 +00:00
m_actionTextHelper - > registerTextWhenNothingIsSelected ( cutAction , i18nc ( " @action " , " Cut… " ) ) ;
2019-06-23 19:19:49 +00:00
cutAction - > setWhatsThis ( xi18nc ( " @info:whatsthis cut " , " This copies the items "
" in your current selection to the <emphasis>clipboard</emphasis>.<nl/> "
" Use the <emphasis>Paste</emphasis> action afterwards to copy them from "
" the clipboard to a new location. The items will be removed from their "
" initial location. " ) + cutCopyPastePara ) ;
QAction * copyAction = KStandardAction : : copy ( this , & DolphinMainWindow : : copy , actionCollection ( ) ) ;
2022-04-24 11:18:30 +00:00
m_actionTextHelper - > registerTextWhenNothingIsSelected ( copyAction , i18nc ( " @action " , " Copy… " ) ) ;
2019-06-23 19:19:49 +00:00
copyAction - > setWhatsThis ( xi18nc ( " @info:whatsthis copy " , " This copies the "
" items in your current selection to the <emphasis>clipboard</emphasis>. "
" <nl/>Use the <emphasis>Paste</emphasis> action afterwards to copy them "
" from the clipboard to a new location. " ) + cutCopyPastePara ) ;
2017-08-24 15:32:06 +00:00
QAction * paste = KStandardAction : : paste ( this , & DolphinMainWindow : : paste , actionCollection ( ) ) ;
2009-10-11 17:43:30 +00:00
// The text of the paste-action is modified dynamically by Dolphin
// (e. g. to "Paste One Folder"). To prevent that the size of the toolbar changes
// due to the long text, the text "Paste" is used:
paste - > setIconText ( i18nc ( " @action:inmenu Edit " , " Paste " ) ) ;
2019-06-23 19:19:49 +00:00
paste - > setWhatsThis ( xi18nc ( " @info:whatsthis paste " , " This copies the items from "
" your <emphasis>clipboard</emphasis> to the currently viewed folder.<nl/> "
" If the items were added to the clipboard by the <emphasis>Cut</emphasis> "
" action they are removed from their old location. " ) + cutCopyPastePara ) ;
2007-04-01 18:36:23 +00:00
Allow to copy or move selection to the other split view
Summary:
FEATURE: 276167
Default keyboard shortcuts set to `SHIFT+F5` for `copy`, `SHIFT+F6` for `move`
Reviewers: #dolphin, elvisangelaccio, ngraham, meven, dfaure
Reviewed By: #dolphin, elvisangelaccio, ngraham, meven, dfaure
Subscribers: yurchor, kde-doc-english, dfaure, meven, kfm-devel
Tags: #dolphin, #documentation
Differential Revision: https://phabricator.kde.org/D29006
2020-05-14 22:17:31 +00:00
QAction * copyToOtherViewAction = actionCollection ( ) - > addAction ( QStringLiteral ( " copy_to_inactive_split_view " ) ) ;
2020-08-26 00:37:31 +00:00
copyToOtherViewAction - > setText ( i18nc ( " @action:inmenu " , " Copy to Inactive Split View " ) ) ;
2022-04-24 11:18:30 +00:00
m_actionTextHelper - > registerTextWhenNothingIsSelected ( copyToOtherViewAction , i18nc ( " @action:inmenu " , " Copy to Inactive Split View… " ) ) ;
Allow to copy or move selection to the other split view
Summary:
FEATURE: 276167
Default keyboard shortcuts set to `SHIFT+F5` for `copy`, `SHIFT+F6` for `move`
Reviewers: #dolphin, elvisangelaccio, ngraham, meven, dfaure
Reviewed By: #dolphin, elvisangelaccio, ngraham, meven, dfaure
Subscribers: yurchor, kde-doc-english, dfaure, meven, kfm-devel
Tags: #dolphin, #documentation
Differential Revision: https://phabricator.kde.org/D29006
2020-05-14 22:17:31 +00:00
copyToOtherViewAction - > setWhatsThis ( xi18nc ( " @info:whatsthis Copy " , " This copies the selected items from "
" the <emphasis>active</emphasis> view to the inactive split view. " ) ) ;
copyToOtherViewAction - > setIcon ( QIcon : : fromTheme ( QStringLiteral ( " edit-copy " ) ) ) ;
2020-08-26 00:37:31 +00:00
copyToOtherViewAction - > setIconText ( i18nc ( " @action:inmenu Edit " , " Copy to Inactive Split View " ) ) ;
2020-12-09 06:55:44 +00:00
actionCollection ( ) - > setDefaultShortcut ( copyToOtherViewAction , Qt : : SHIFT | Qt : : Key_F5 ) ;
2021-09-12 13:33:39 +00:00
connect ( copyToOtherViewAction , & QAction : : triggered , this , & DolphinMainWindow : : copyToInactiveSplitView ) ;
Allow to copy or move selection to the other split view
Summary:
FEATURE: 276167
Default keyboard shortcuts set to `SHIFT+F5` for `copy`, `SHIFT+F6` for `move`
Reviewers: #dolphin, elvisangelaccio, ngraham, meven, dfaure
Reviewed By: #dolphin, elvisangelaccio, ngraham, meven, dfaure
Subscribers: yurchor, kde-doc-english, dfaure, meven, kfm-devel
Tags: #dolphin, #documentation
Differential Revision: https://phabricator.kde.org/D29006
2020-05-14 22:17:31 +00:00
QAction * moveToOtherViewAction = actionCollection ( ) - > addAction ( QStringLiteral ( " move_to_inactive_split_view " ) ) ;
2020-08-26 00:37:31 +00:00
moveToOtherViewAction - > setText ( i18nc ( " @action:inmenu " , " Move to Inactive Split View " ) ) ;
2022-04-24 11:18:30 +00:00
m_actionTextHelper - > registerTextWhenNothingIsSelected ( moveToOtherViewAction , i18nc ( " @action:inmenu " , " Move to Inactive Split View… " ) ) ;
Allow to copy or move selection to the other split view
Summary:
FEATURE: 276167
Default keyboard shortcuts set to `SHIFT+F5` for `copy`, `SHIFT+F6` for `move`
Reviewers: #dolphin, elvisangelaccio, ngraham, meven, dfaure
Reviewed By: #dolphin, elvisangelaccio, ngraham, meven, dfaure
Subscribers: yurchor, kde-doc-english, dfaure, meven, kfm-devel
Tags: #dolphin, #documentation
Differential Revision: https://phabricator.kde.org/D29006
2020-05-14 22:17:31 +00:00
moveToOtherViewAction - > setWhatsThis ( xi18nc ( " @info:whatsthis Move " , " This moves the selected items from "
" the <emphasis>active</emphasis> view to the inactive split view. " ) ) ;
moveToOtherViewAction - > setIcon ( QIcon : : fromTheme ( QStringLiteral ( " edit-cut " ) ) ) ;
2020-08-26 00:37:31 +00:00
moveToOtherViewAction - > setIconText ( i18nc ( " @action:inmenu Edit " , " Move to Inactive Split View " ) ) ;
2020-12-09 06:55:44 +00:00
actionCollection ( ) - > setDefaultShortcut ( moveToOtherViewAction , Qt : : SHIFT | Qt : : Key_F6 ) ;
2021-09-12 13:33:39 +00:00
connect ( moveToOtherViewAction , & QAction : : triggered , this , & DolphinMainWindow : : moveToInactiveSplitView ) ;
Allow to copy or move selection to the other split view
Summary:
FEATURE: 276167
Default keyboard shortcuts set to `SHIFT+F5` for `copy`, `SHIFT+F6` for `move`
Reviewers: #dolphin, elvisangelaccio, ngraham, meven, dfaure
Reviewed By: #dolphin, elvisangelaccio, ngraham, meven, dfaure
Subscribers: yurchor, kde-doc-english, dfaure, meven, kfm-devel
Tags: #dolphin, #documentation
Differential Revision: https://phabricator.kde.org/D29006
2020-05-14 22:17:31 +00:00
2020-12-02 07:07:41 +00:00
QAction * showFilterBar = actionCollection ( ) - > addAction ( QStringLiteral ( " show_filter_bar " ) ) ;
showFilterBar - > setText ( i18nc ( " @action:inmenu Tools " , " Filter... " ) ) ;
2021-12-02 18:02:40 +00:00
showFilterBar - > setToolTip ( i18nc ( " @info:tooltip " , " Show Filter Bar " ) ) ;
2020-12-02 07:07:41 +00:00
showFilterBar - > setWhatsThis ( xi18nc ( " @info:whatsthis " , " This opens the "
" <emphasis>Filter Bar</emphasis> at the bottom of the window.<nl/> "
" There you can enter a text to filter the files and folders currently displayed. "
" Only those that contain the text in their name will be kept in view. " ) ) ;
showFilterBar - > setIcon ( QIcon : : fromTheme ( QStringLiteral ( " view-filter " ) ) ) ;
2020-12-09 06:55:44 +00:00
actionCollection ( ) - > setDefaultShortcuts ( showFilterBar , { Qt : : CTRL | Qt : : Key_I , Qt : : Key_Slash } ) ;
2020-12-02 07:07:41 +00:00
connect ( showFilterBar , & QAction : : triggered , this , & DolphinMainWindow : : showFilterBar ) ;
// toggle_filter acts as a copy of the main showFilterBar to be used mainly
// in the toolbar, with no default shortcut attached, to avoid messing with
// existing workflows (filter bar always open and Ctrl-I to focus)
QAction * toggleFilter = actionCollection ( ) - > addAction ( QStringLiteral ( " toggle_filter " ) ) ;
toggleFilter - > setText ( i18nc ( " @action:inmenu " , " Toggle Filter Bar " ) ) ;
toggleFilter - > setIconText ( i18nc ( " @action:intoolbar " , " Filter " ) ) ;
toggleFilter - > setIcon ( showFilterBar - > icon ( ) ) ;
toggleFilter - > setToolTip ( showFilterBar - > toolTip ( ) ) ;
toggleFilter - > setWhatsThis ( showFilterBar - > whatsThis ( ) ) ;
toggleFilter - > setCheckable ( true ) ;
connect ( toggleFilter , & QAction : : triggered , this , & DolphinMainWindow : : toggleFilterBar ) ;
Use placeholder for search action
Summary:
See https://hig.kde.org/style/writing/placeholder.html
Screenshot:
Old: {F6691712}
New: {F6698685}
Test Plan: Compile and run
Reviewers: #dolphin, #vdg, ngraham, elvisangelaccio
Reviewed By: #dolphin, #vdg, ngraham
Subscribers: GB_2, kde-doc-english, elvisangelaccio, ngraham, yurchor, kfm-devel
Tags: #dolphin, #documentation
Maniphest Tasks: T10258
Differential Revision: https://phabricator.kde.org/D19770
2019-03-14 19:53:49 +00:00
QAction * searchAction = KStandardAction : : find ( this , & DolphinMainWindow : : find , actionCollection ( ) ) ;
searchAction - > setText ( i18n ( " Search... " ) ) ;
2019-06-23 19:19:49 +00:00
searchAction - > setToolTip ( i18nc ( " @info:tooltip " , " Search for files and folders " ) ) ;
searchAction - > setWhatsThis ( xi18nc ( " @info:whatsthis find " , " <para>This helps you "
" find files and folders by opening a <emphasis>find bar</emphasis>. "
" There you can enter search terms and specify settings to find the "
" objects you are looking for.</para><para>Use this help again on "
" the find bar so we can have a look at it while the settings are "
" explained.</para> " ) ) ;
[dolphin] Add an action to toggle the searchbar
Summary:
Make search action toggle the searchbar instead of just launching it.
The search action in dolphin did only bring up the search bar, but to close it again you had to go to the closing button on the same searchbar.
This behavior in inconsistent with other dolphin actions which toggle panels or tools.
BEFORE:
{F7256652}
AFTER:
{F7256862}
BUG: 344617
FIXED-IN: 19.12.0
Closes T8473
Depends on D23075
Test Plan:
- Enable the search mode: the searchbar appears and the toolbar button gets checked
- Press the search button again, and it goes back to normal mode.
- The search button state is coherent with the searchbox
- Coherence is kept when changing to a split view or different tab
- Shorcut <Ctrl-F> does not close the searchbar, but moves the focus to it.
Reviewers: #dolphin, ngraham, #vdg, elvisangelaccio
Reviewed By: ngraham, #vdg
Subscribers: ndavis, felixernst, elvisangelaccio, kfm-devel
Tags: #dolphin
Maniphest Tasks: T8473
Differential Revision: https://phabricator.kde.org/D23232
2019-09-01 19:59:43 +00:00
// toggle_search acts as a copy of the main searchAction to be used mainly
// in the toolbar, with no default shortcut attached, to avoid messing with
// existing workflows (search bar always open and Ctrl-F to focus)
QAction * toggleSearchAction = actionCollection ( ) - > addAction ( QStringLiteral ( " toggle_search " ) ) ;
toggleSearchAction - > setText ( i18nc ( " @action:inmenu " , " Toggle Search Bar " ) ) ;
toggleSearchAction - > setIconText ( i18nc ( " @action:intoolbar " , " Search " ) ) ;
toggleSearchAction - > setIcon ( searchAction - > icon ( ) ) ;
toggleSearchAction - > setToolTip ( searchAction - > toolTip ( ) ) ;
toggleSearchAction - > setWhatsThis ( searchAction - > whatsThis ( ) ) ;
toggleSearchAction - > setCheckable ( true ) ;
2021-09-12 13:33:39 +00:00
QAction * toggleSelectionModeAction = actionCollection ( ) - > addAction ( QStringLiteral ( " toggle_selection_mode " ) ) ;
// i18n: This action toggles a selection mode.
toggleSelectionModeAction - > setText ( i18nc ( " @action:inmenu " , " Select Files and Folders " ) ) ;
2022-04-25 10:52:05 +00:00
// i18n: Opens a selection mode for selecting files/folders.
2021-09-12 13:33:39 +00:00
// The text is kept so unspecific because it will be shown on the toolbar where space is at a premium.
toggleSelectionModeAction - > setIconText ( i18nc ( " @action:intoolbar " , " Select " ) ) ;
2022-04-24 00:34:43 +00:00
toggleSelectionModeAction - > setWhatsThis ( xi18nc ( " @info:whatsthis " , " <para>This application only knows which files or folders should be acted on if they are "
" <emphasis>selected</emphasis> first. Press this to toggle a <emphasis>Selection Mode</emphasis> which makes selecting and deselecting as easy as "
" pressing an item once.</para><para>While in this mode, a quick access bar at the bottom shows available actions for the currently selected items. "
" </para> " ) ) ;
2021-09-12 13:33:39 +00:00
toggleSelectionModeAction - > setIcon ( QIcon : : fromTheme ( QStringLiteral ( " quickwizard " ) ) ) ;
toggleSelectionModeAction - > setCheckable ( true ) ;
connect ( toggleSelectionModeAction , & QAction : : triggered , this , & DolphinMainWindow : : toggleSelectionMode ) ;
// A special version of the toggleSelectionModeAction for the toolbar that also contains a menu
// with the selectAllAction and invertSelectionAction.
auto * toggleSelectionModeToolBarAction = new KToolBarPopupAction ( toggleSelectionModeAction - > icon ( ) , toggleSelectionModeAction - > iconText ( ) , actionCollection ( ) ) ;
toggleSelectionModeToolBarAction - > setToolTip ( toggleSelectionModeAction - > text ( ) ) ;
toggleSelectionModeToolBarAction - > setWhatsThis ( toggleSelectionModeAction - > whatsThis ( ) ) ;
2022-04-24 00:34:43 +00:00
actionCollection ( ) - > addAction ( QStringLiteral ( " toggle_selection_mode_tool_bar " ) , toggleSelectionModeToolBarAction ) ;
2021-09-12 13:33:39 +00:00
toggleSelectionModeToolBarAction - > setCheckable ( true ) ;
toggleSelectionModeToolBarAction - > setPopupMode ( QToolButton : : DelayedPopup ) ;
connect ( toggleSelectionModeToolBarAction , & QAction : : triggered , toggleSelectionModeAction , & QAction : : trigger ) ;
connect ( toggleSelectionModeAction , & QAction : : toggled , toggleSelectionModeToolBarAction , & QAction : : setChecked ) ;
2019-06-23 19:19:49 +00:00
QAction * selectAllAction = KStandardAction : : selectAll ( this , & DolphinMainWindow : : selectAll , actionCollection ( ) ) ;
selectAllAction - > setWhatsThis ( xi18nc ( " @info:whatsthis " , " This selects all "
" files and folders in the current location. " ) ) ;
2007-04-01 18:36:23 +00:00
2016-03-16 21:17:37 +00:00
QAction * invertSelection = actionCollection ( ) - > addAction ( QStringLiteral ( " invert_selection " ) ) ;
2007-06-30 20:10:50 +00:00
invertSelection - > setText ( i18nc ( " @action:inmenu Edit " , " Invert Selection " ) ) ;
2019-06-23 19:19:49 +00:00
invertSelection - > setWhatsThis ( xi18nc ( " @info:whatsthis invert " , " This selects all "
" objects that you have currently <emphasis>not</emphasis> selected instead. " ) ) ;
2018-02-14 14:40:36 +00:00
invertSelection - > setIcon ( QIcon : : fromTheme ( QStringLiteral ( " edit-select-invert " ) ) ) ;
2020-12-09 06:55:44 +00:00
actionCollection ( ) - > setDefaultShortcut ( invertSelection , Qt : : CTRL | Qt : : SHIFT | Qt : : Key_A ) ;
2014-04-10 14:53:41 +00:00
connect ( invertSelection , & QAction : : triggered , this , & DolphinMainWindow : : invertSelection ) ;
2007-04-01 18:36:23 +00:00
2021-09-12 13:33:39 +00:00
QMenu * toggleSelectionModeActionMenu = new QMenu ( this ) ;
toggleSelectionModeActionMenu - > addAction ( selectAllAction ) ;
toggleSelectionModeActionMenu - > addAction ( invertSelection ) ;
toggleSelectionModeToolBarAction - > setMenu ( toggleSelectionModeActionMenu ) ;
2007-04-01 18:36:23 +00:00
// setup 'View' menu
2008-02-13 20:52:21 +00:00
// (note that most of it is set up in DolphinViewActionHandler)
2007-04-01 18:36:23 +00:00
2016-03-16 21:17:37 +00:00
QAction * split = actionCollection ( ) - > addAction ( QStringLiteral ( " split_view " ) ) ;
2019-06-23 19:19:49 +00:00
split - > setWhatsThis ( xi18nc ( " @info:whatsthis find " , " <para>This splits "
" the folder view below into two autonomous views.</para><para>This "
" way you can see two locations at once and move items between them "
" quickly.</para>Click this again afterwards to recombine the views. " ) ) ;
2014-09-14 20:49:25 +00:00
actionCollection ( ) - > setDefaultShortcut ( split , Qt : : Key_F3 ) ;
2014-04-10 14:53:41 +00:00
connect ( split , & QAction : : triggered , this , & DolphinMainWindow : : toggleSplitView ) ;
2007-04-01 18:36:23 +00:00
2016-09-26 16:55:42 +00:00
QAction * stashSplit = actionCollection ( ) - > addAction ( QStringLiteral ( " split_stash " ) ) ;
2020-12-09 06:55:44 +00:00
actionCollection ( ) - > setDefaultShortcut ( stashSplit , Qt : : CTRL | Qt : : Key_S ) ;
2016-09-26 16:55:42 +00:00
stashSplit - > setText ( i18nc ( " @action:intoolbar Stash " , " Stash " ) ) ;
stashSplit - > setToolTip ( i18nc ( " @info " , " Opens the stash virtual directory in a split window " ) ) ;
2017-11-08 14:06:46 +00:00
stashSplit - > setIcon ( QIcon : : fromTheme ( QStringLiteral ( " folder-stash " ) ) ) ;
2017-02-02 16:16:54 +00:00
stashSplit - > setCheckable ( false ) ;
2021-07-09 08:30:58 +00:00
QDBusConnectionInterface * sessionInterface = QDBusConnection : : sessionBus ( ) . interface ( ) ;
stashSplit - > setVisible ( sessionInterface & & sessionInterface - > isServiceRegistered ( QStringLiteral ( " org.kde.kio.StashNotifier " ) ) ) ;
2016-09-26 16:55:42 +00:00
connect ( stashSplit , & QAction : : triggered , this , & DolphinMainWindow : : toggleSplitStash ) ;
2018-03-10 19:50:29 +00:00
KStandardAction : : redisplay ( this , & DolphinMainWindow : : reloadView , actionCollection ( ) ) ;
2007-04-01 18:36:23 +00:00
2016-03-16 21:17:37 +00:00
QAction * stop = actionCollection ( ) - > addAction ( QStringLiteral ( " stop " ) ) ;
2007-06-30 20:10:50 +00:00
stop - > setText ( i18nc ( " @action:inmenu View " , " Stop " ) ) ;
2009-11-06 18:02:55 +00:00
stop - > setToolTip ( i18nc ( " @info " , " Stop loading " ) ) ;
2019-06-23 19:19:49 +00:00
stop - > setWhatsThis ( i18nc ( " @info " , " This stops the loading of the contents of the current folder. " ) ) ;
2016-03-16 21:17:37 +00:00
stop - > setIcon ( QIcon : : fromTheme ( QStringLiteral ( " process-stop " ) ) ) ;
2014-04-10 14:53:41 +00:00
connect ( stop , & QAction : : triggered , this , & DolphinMainWindow : : stopLoading ) ;
2007-04-01 18:36:23 +00:00
2016-03-16 21:17:37 +00:00
KToggleAction * editableLocation = actionCollection ( ) - > add < KToggleAction > ( QStringLiteral ( " editable_location " ) ) ;
2011-03-26 22:22:21 +00:00
editableLocation - > setText ( i18nc ( " @action:inmenu Navigation Bar " , " Editable Location " ) ) ;
2019-06-23 19:19:49 +00:00
editableLocation - > setWhatsThis ( xi18nc ( " @info:whatsthis " ,
" This toggles the <emphasis>Location Bar</emphasis> to be "
" editable so you can directly enter a location you want to go to.<nl/> "
" You can also switch to editing by clicking to the right of the "
" location and switch back by confirming the edited location. " ) ) ;
2014-09-14 20:49:25 +00:00
actionCollection ( ) - > setDefaultShortcut ( editableLocation , Qt : : Key_F6 ) ;
2014-04-10 14:53:41 +00:00
connect ( editableLocation , & KToggleAction : : triggered , this , & DolphinMainWindow : : toggleEditLocation ) ;
2007-04-01 18:36:23 +00:00
2016-03-16 21:17:37 +00:00
QAction * replaceLocation = actionCollection ( ) - > addAction ( QStringLiteral ( " replace_location " ) ) ;
2008-10-25 09:41:39 +00:00
replaceLocation - > setText ( i18nc ( " @action:inmenu Navigation Bar " , " Replace Location " ) ) ;
2019-06-23 19:19:49 +00:00
// i18n: "enter" is used both in the meaning of "writing" and "going to" a new location here.
// Both meanings are useful but not necessary to understand the use of "Replace Location".
// So you might want to be more verbose in your language to convey the meaning but it's up to you.
replaceLocation - > setWhatsThis ( xi18nc ( " @info:whatsthis " ,
" This switches to editing the location and selects it "
" so you can quickly enter a different location. " ) ) ;
2020-12-09 06:55:44 +00:00
actionCollection ( ) - > setDefaultShortcut ( replaceLocation , Qt : : CTRL | Qt : : Key_L ) ;
2014-04-10 14:53:41 +00:00
connect ( replaceLocation , & QAction : : triggered , this , & DolphinMainWindow : : replaceLocation ) ;
2007-04-01 18:36:23 +00:00
// setup 'Go' menu
Add navigation history to forward/back buttons
Summary:
Adds navigation history to forward/back buttons in the toolbar. This
changes the forward/back buttons in the toolbar to use the
KToolBarPopupAction class which provides access to a drop down menu.
Test Plan:
Browse some folders
Click the back drop down menu and navigate somewhere
Click the forward drop down menu and navigate somewhere
FEATURE: 157819
FIXED-IN: 19.12.0
Reviewers: #dolphin, ngraham, elvisangelaccio, #vdg
Reviewed By: #dolphin, ngraham, elvisangelaccio, #vdg
Subscribers: felixernst, nerdopolist, mart, richardl, ognarb, david.fontanals, abetts, kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D19311
2019-04-11 17:21:41 +00:00
{
QScopedPointer < QAction > backAction ( KStandardAction : : back ( nullptr , nullptr , nullptr ) ) ;
m_backAction = new KToolBarPopupAction ( backAction - > icon ( ) , backAction - > text ( ) , actionCollection ( ) ) ;
m_backAction - > setObjectName ( backAction - > objectName ( ) ) ;
m_backAction - > setShortcuts ( backAction - > shortcuts ( ) ) ;
}
2020-12-06 18:47:07 +00:00
m_backAction - > setPopupMode ( QToolButton : : DelayedPopup ) ;
Add navigation history to forward/back buttons
Summary:
Adds navigation history to forward/back buttons in the toolbar. This
changes the forward/back buttons in the toolbar to use the
KToolBarPopupAction class which provides access to a drop down menu.
Test Plan:
Browse some folders
Click the back drop down menu and navigate somewhere
Click the forward drop down menu and navigate somewhere
FEATURE: 157819
FIXED-IN: 19.12.0
Reviewers: #dolphin, ngraham, elvisangelaccio, #vdg
Reviewed By: #dolphin, ngraham, elvisangelaccio, #vdg
Subscribers: felixernst, nerdopolist, mart, richardl, ognarb, david.fontanals, abetts, kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D19311
2019-04-11 17:21:41 +00:00
connect ( m_backAction , & QAction : : triggered , this , & DolphinMainWindow : : goBack ) ;
connect ( m_backAction - > menu ( ) , & QMenu : : aboutToShow , this , & DolphinMainWindow : : slotAboutToShowBackPopupMenu ) ;
connect ( m_backAction - > menu ( ) , & QMenu : : triggered , this , & DolphinMainWindow : : slotGoBack ) ;
actionCollection ( ) - > addAction ( m_backAction - > objectName ( ) , m_backAction ) ;
auto backShortcuts = m_backAction - > shortcuts ( ) ;
2014-04-06 01:32:55 +00:00
backShortcuts . append ( QKeySequence ( Qt : : Key_Backspace ) ) ;
Add navigation history to forward/back buttons
Summary:
Adds navigation history to forward/back buttons in the toolbar. This
changes the forward/back buttons in the toolbar to use the
KToolBarPopupAction class which provides access to a drop down menu.
Test Plan:
Browse some folders
Click the back drop down menu and navigate somewhere
Click the forward drop down menu and navigate somewhere
FEATURE: 157819
FIXED-IN: 19.12.0
Reviewers: #dolphin, ngraham, elvisangelaccio, #vdg
Reviewed By: #dolphin, ngraham, elvisangelaccio, #vdg
Subscribers: felixernst, nerdopolist, mart, richardl, ognarb, david.fontanals, abetts, kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D19311
2019-04-11 17:21:41 +00:00
actionCollection ( ) - > setDefaultShortcuts ( m_backAction , backShortcuts ) ;
2007-09-09 19:02:22 +00:00
2014-06-19 20:04:36 +00:00
DolphinRecentTabsMenu * recentTabsMenu = new DolphinRecentTabsMenu ( this ) ;
2016-03-16 21:17:37 +00:00
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 " ) ) ;
2014-07-22 12:01:49 +00:00
undoCloseTab - > setText ( i18nc ( " @action:inmenu File " , " Undo close tab " ) ) ;
2019-06-23 19:19:49 +00:00
undoCloseTab - > setWhatsThis ( i18nc ( " @info:whatsthis undo close tab " ,
" This returns you to the previously closed tab. " ) ) ;
2020-12-09 06:55:44 +00:00
actionCollection ( ) - > setDefaultShortcut ( undoCloseTab , Qt : : CTRL | Qt : : SHIFT | Qt : : Key_T ) ;
2016-03-16 21:17:37 +00:00
undoCloseTab - > setIcon ( QIcon : : fromTheme ( QStringLiteral ( " edit-undo " ) ) ) ;
2014-07-22 12:01:49 +00:00
undoCloseTab - > setEnabled ( false ) ;
2016-03-16 21:17:37 +00:00
connect ( undoCloseTab , & QAction : : triggered , recentTabsMenu , & DolphinRecentTabsMenu : : undoCloseTab ) ;
2009-03-01 01:38:20 +00:00
2015-01-28 14:04:32 +00:00
auto undoAction = actionCollection ( ) - > action ( KStandardAction : : name ( KStandardAction : : Undo ) ) ;
2019-06-23 19:19:49 +00:00
undoAction - > setWhatsThis ( xi18nc ( " @info:whatsthis " , " This undoes "
" the last change you made to files or folders.<nl/> "
" Such changes include <interface>creating, renaming</interface> "
" and <interface>moving</interface> them to a different location "
" or to the <filename>Trash</filename>. <nl/>Changes that can't "
" be undone will ask for your confirmation. " ) ) ;
2015-01-28 14:04:32 +00:00
undoAction - > setEnabled ( false ) ; // undo should be disabled by default
Add navigation history to forward/back buttons
Summary:
Adds navigation history to forward/back buttons in the toolbar. This
changes the forward/back buttons in the toolbar to use the
KToolBarPopupAction class which provides access to a drop down menu.
Test Plan:
Browse some folders
Click the back drop down menu and navigate somewhere
Click the forward drop down menu and navigate somewhere
FEATURE: 157819
FIXED-IN: 19.12.0
Reviewers: #dolphin, ngraham, elvisangelaccio, #vdg
Reviewed By: #dolphin, ngraham, elvisangelaccio, #vdg
Subscribers: felixernst, nerdopolist, mart, richardl, ognarb, david.fontanals, abetts, kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D19311
2019-04-11 17:21:41 +00:00
{
QScopedPointer < QAction > forwardAction ( KStandardAction : : forward ( nullptr , nullptr , nullptr ) ) ;
m_forwardAction = new KToolBarPopupAction ( forwardAction - > icon ( ) , forwardAction - > text ( ) , actionCollection ( ) ) ;
m_forwardAction - > setObjectName ( forwardAction - > objectName ( ) ) ;
m_forwardAction - > setShortcuts ( forwardAction - > shortcuts ( ) ) ;
}
2020-12-06 18:47:07 +00:00
m_forwardAction - > setPopupMode ( QToolButton : : DelayedPopup ) ;
Add navigation history to forward/back buttons
Summary:
Adds navigation history to forward/back buttons in the toolbar. This
changes the forward/back buttons in the toolbar to use the
KToolBarPopupAction class which provides access to a drop down menu.
Test Plan:
Browse some folders
Click the back drop down menu and navigate somewhere
Click the forward drop down menu and navigate somewhere
FEATURE: 157819
FIXED-IN: 19.12.0
Reviewers: #dolphin, ngraham, elvisangelaccio, #vdg
Reviewed By: #dolphin, ngraham, elvisangelaccio, #vdg
Subscribers: felixernst, nerdopolist, mart, richardl, ognarb, david.fontanals, abetts, kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D19311
2019-04-11 17:21:41 +00:00
connect ( m_forwardAction , & QAction : : triggered , this , & DolphinMainWindow : : goForward ) ;
connect ( m_forwardAction - > menu ( ) , & QMenu : : aboutToShow , this , & DolphinMainWindow : : slotAboutToShowForwardPopupMenu ) ;
connect ( m_forwardAction - > menu ( ) , & QMenu : : triggered , this , & DolphinMainWindow : : slotGoForward ) ;
actionCollection ( ) - > addAction ( m_forwardAction - > objectName ( ) , m_forwardAction ) ;
2019-10-01 15:24:53 +00:00
actionCollection ( ) - > setDefaultShortcuts ( m_forwardAction , m_forwardAction - > shortcuts ( ) ) ;
Add navigation history to forward/back buttons
Summary:
Adds navigation history to forward/back buttons in the toolbar. This
changes the forward/back buttons in the toolbar to use the
KToolBarPopupAction class which provides access to a drop down menu.
Test Plan:
Browse some folders
Click the back drop down menu and navigate somewhere
Click the forward drop down menu and navigate somewhere
FEATURE: 157819
FIXED-IN: 19.12.0
Reviewers: #dolphin, ngraham, elvisangelaccio, #vdg
Reviewed By: #dolphin, ngraham, elvisangelaccio, #vdg
Subscribers: felixernst, nerdopolist, mart, richardl, ognarb, david.fontanals, abetts, kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D19311
2019-04-11 17:21:41 +00:00
// enable middle-click to open in a new tab
auto * middleClickEventFilter = new MiddleClickActionEventFilter ( this ) ;
connect ( middleClickEventFilter , & MiddleClickActionEventFilter : : actionMiddleClicked , this , & DolphinMainWindow : : slotBackForwardActionMiddleClicked ) ;
m_backAction - > menu ( ) - > installEventFilter ( middleClickEventFilter ) ;
m_forwardAction - > menu ( ) - > installEventFilter ( middleClickEventFilter ) ;
2017-08-24 15:32:06 +00:00
KStandardAction : : up ( this , & DolphinMainWindow : : goUp , actionCollection ( ) ) ;
2019-06-23 19:19:49 +00:00
QAction * homeAction = KStandardAction : : home ( this , & DolphinMainWindow : : goHome , actionCollection ( ) ) ;
homeAction - > setWhatsThis ( xi18nc ( " @info:whatsthis " , " Go to your "
" <filename>Home</filename> folder.<nl/>Every user account "
" has their own <filename>Home</filename> that contains their data "
" including folders that contain personal application data. " ) ) ;
2011-03-29 16:35:50 +00:00
2007-04-01 18:36:23 +00:00
// setup 'Tools' menu
2016-03-16 21:17:37 +00:00
QAction * compareFiles = actionCollection ( ) - > addAction ( QStringLiteral ( " compare_files " ) ) ;
2007-06-30 20:10:50 +00:00
compareFiles - > setText ( i18nc ( " @action:inmenu Tools " , " Compare Files " ) ) ;
2016-03-16 21:17:37 +00:00
compareFiles - > setIcon ( QIcon : : fromTheme ( QStringLiteral ( " kompare " ) ) ) ;
2007-04-01 18:36:23 +00:00
compareFiles - > setEnabled ( false ) ;
2014-04-10 14:53:41 +00:00
connect ( compareFiles , & QAction : : triggered , this , & DolphinMainWindow : : compareFiles ) ;
2007-04-01 18:36:23 +00:00
2019-11-17 17:14:27 +00:00
QAction * openPreferredSearchTool = actionCollection ( ) - > addAction ( QStringLiteral ( " open_preferred_search_tool " ) ) ;
openPreferredSearchTool - > setText ( i18nc ( " @action:inmenu Tools " , " Open Preferred Search Tool " ) ) ;
openPreferredSearchTool - > setWhatsThis ( xi18nc ( " @info:whatsthis " ,
" <para>This opens a preferred search tool for the viewed location.</para> "
" <para>Use <emphasis>More Search Tools</emphasis> menu to configure it.</para> " ) ) ;
openPreferredSearchTool - > setIcon ( QIcon : : fromTheme ( QStringLiteral ( " search " ) ) ) ;
2020-12-09 06:55:44 +00:00
actionCollection ( ) - > setDefaultShortcut ( openPreferredSearchTool , Qt : : CTRL | Qt : : SHIFT | Qt : : Key_F ) ;
2019-11-17 17:14:27 +00:00
connect ( openPreferredSearchTool , & QAction : : triggered , this , & DolphinMainWindow : : openPreferredSearchTool ) ;
2016-05-26 12:51:23 +00:00
if ( KAuthorized : : authorize ( QStringLiteral ( " shell_access " ) ) ) {
2016-05-18 01:06:49 +00:00
QAction * openTerminal = actionCollection ( ) - > addAction ( QStringLiteral ( " open_terminal " ) ) ;
openTerminal - > setText ( i18nc ( " @action:inmenu Tools " , " Open Terminal " ) ) ;
2019-06-23 19:19:49 +00:00
openTerminal - > setWhatsThis ( xi18nc ( " @info:whatsthis " ,
" <para>This opens a <emphasis>terminal</emphasis> application for the viewed location.</para> "
" <para>To learn more about terminals use the help in the terminal application.</para> " ) ) ;
2020-11-17 19:23:02 +00:00
openTerminal - > setIcon ( QIcon : : fromTheme ( QStringLiteral ( " utilities-terminal " ) ) ) ;
2020-12-09 06:55:44 +00:00
actionCollection ( ) - > setDefaultShortcut ( openTerminal , Qt : : SHIFT | Qt : : Key_F4 ) ;
2016-05-18 01:06:49 +00:00
connect ( openTerminal , & QAction : : triggered , this , & DolphinMainWindow : : openTerminal ) ;
Add action for focusing Terminal Panel
Summary:
Add an action for focusing and de-focusing the Terminal Panel.
FEATURE: 185096
FIXED-IN 20.04.0
Test Plan:
- Hit {key Ctrl Shift F4} or click {nav Tools > Focus Terminal Panel} or {nav Control > Tools > Focus Terminal Panel}
- If the Terminal Panel was closed, it opens and gains focus
- If the Terminal Panel was open but unfocused, it gains focus
- If the Terminal Panel was open and focused, focus returns to the view
{F6630289, size=full}
Reviewers: #dolphin, elvisangelaccio, rominf
Reviewed By: #dolphin, elvisangelaccio, rominf
Subscribers: kfm-devel, elvisangelaccio, rkflx, ngraham, #dolphin
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D10959
2019-03-20 22:06:28 +00:00
2022-05-02 20:25:24 +00:00
QAction * openTerminalHere = actionCollection ( ) - > addAction ( QStringLiteral ( " open_terminal_here " ) ) ;
// i18n: "Here" refers to the location(s) of the currently selected item(s) or the currently viewed location if nothing is selected.
openTerminalHere - > setText ( i18nc ( " @action:inmenu Tools " , " Open Terminal Here " ) ) ;
openTerminalHere - > setWhatsThis ( xi18nc ( " @info:whatsthis " ,
" <para>This opens <emphasis>terminal</emphasis> applications for the selected items' locations.</para> "
" <para>To learn more about terminals use the help in the terminal application.</para> " ) ) ;
openTerminalHere - > setIcon ( QIcon : : fromTheme ( QStringLiteral ( " utilities-terminal " ) ) ) ;
actionCollection ( ) - > setDefaultShortcut ( openTerminalHere , Qt : : SHIFT | Qt : : ALT | Qt : : Key_F4 ) ;
connect ( openTerminalHere , & QAction : : triggered , this , & DolphinMainWindow : : openTerminalHere ) ;
2022-06-11 17:16:13 +00:00
# if HAVE_TERMINAL
Add action for focusing Terminal Panel
Summary:
Add an action for focusing and de-focusing the Terminal Panel.
FEATURE: 185096
FIXED-IN 20.04.0
Test Plan:
- Hit {key Ctrl Shift F4} or click {nav Tools > Focus Terminal Panel} or {nav Control > Tools > Focus Terminal Panel}
- If the Terminal Panel was closed, it opens and gains focus
- If the Terminal Panel was open but unfocused, it gains focus
- If the Terminal Panel was open and focused, focus returns to the view
{F6630289, size=full}
Reviewers: #dolphin, elvisangelaccio, rominf
Reviewed By: #dolphin, elvisangelaccio, rominf
Subscribers: kfm-devel, elvisangelaccio, rkflx, ngraham, #dolphin
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D10959
2019-03-20 22:06:28 +00:00
QAction * focusTerminalPanel = actionCollection ( ) - > addAction ( QStringLiteral ( " focus_terminal_panel " ) ) ;
focusTerminalPanel - > setText ( i18nc ( " @action:inmenu Tools " , " Focus Terminal Panel " ) ) ;
focusTerminalPanel - > setIcon ( QIcon : : fromTheme ( QStringLiteral ( " swap-panels " ) ) ) ;
2020-12-09 06:55:44 +00:00
actionCollection ( ) - > setDefaultShortcut ( focusTerminalPanel , Qt : : CTRL | Qt : : SHIFT | Qt : : Key_F4 ) ;
Add action for focusing Terminal Panel
Summary:
Add an action for focusing and de-focusing the Terminal Panel.
FEATURE: 185096
FIXED-IN 20.04.0
Test Plan:
- Hit {key Ctrl Shift F4} or click {nav Tools > Focus Terminal Panel} or {nav Control > Tools > Focus Terminal Panel}
- If the Terminal Panel was closed, it opens and gains focus
- If the Terminal Panel was open but unfocused, it gains focus
- If the Terminal Panel was open and focused, focus returns to the view
{F6630289, size=full}
Reviewers: #dolphin, elvisangelaccio, rominf
Reviewed By: #dolphin, elvisangelaccio, rominf
Subscribers: kfm-devel, elvisangelaccio, rkflx, ngraham, #dolphin
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D10959
2019-03-20 22:06:28 +00:00
connect ( focusTerminalPanel , & QAction : : triggered , this , & DolphinMainWindow : : focusTerminalPanel ) ;
2018-01-21 11:15:07 +00:00
# endif
2020-08-26 08:58:56 +00:00
}
2009-03-10 06:59:27 +00:00
Add Bookmark Handling
Summary:
Add Bookmark Handling. Adds complete bookmark support as provided by
other KDE applications like Konsole and Konqueror. This allows you to
bookmark individual folders, create bookmark folders and open them.
Test Plan:
Go -> Bookmark -> Add Bookmark
Go -> Bookmark -> [Open the bookmark you selected]
FEATURE: 171366
Reviewers: #dolphin, elvisangelaccio, ngraham
Reviewed By: #dolphin, elvisangelaccio, ngraham
Subscribers: ognarb, meven, loh.tar, cfeck, hein, kfm-devel
Tags: #dolphin
Maniphest Tasks: T5408
Differential Revision: https://phabricator.kde.org/D19926
2019-03-20 19:29:20 +00:00
// setup 'Bookmarks' menu
KActionMenu * bookmarkMenu = new KActionMenu ( i18nc ( " @title:menu " , " &Bookmarks " ) , this ) ;
2019-06-07 15:50:53 +00:00
bookmarkMenu - > setIcon ( QIcon : : fromTheme ( QStringLiteral ( " bookmarks " ) ) ) ;
// Make the toolbar button version work properly on click
2020-12-06 18:47:07 +00:00
bookmarkMenu - > setPopupMode ( QToolButton : : InstantPopup ) ;
Add Bookmark Handling
Summary:
Add Bookmark Handling. Adds complete bookmark support as provided by
other KDE applications like Konsole and Konqueror. This allows you to
bookmark individual folders, create bookmark folders and open them.
Test Plan:
Go -> Bookmark -> Add Bookmark
Go -> Bookmark -> [Open the bookmark you selected]
FEATURE: 171366
Reviewers: #dolphin, elvisangelaccio, ngraham
Reviewed By: #dolphin, elvisangelaccio, ngraham
Subscribers: ognarb, meven, loh.tar, cfeck, hein, kfm-devel
Tags: #dolphin
Maniphest Tasks: T5408
Differential Revision: https://phabricator.kde.org/D19926
2019-03-20 19:29:20 +00:00
m_bookmarkHandler = new DolphinBookmarkHandler ( this , actionCollection ( ) , bookmarkMenu - > menu ( ) , this ) ;
actionCollection ( ) - > addAction ( QStringLiteral ( " bookmarks " ) , bookmarkMenu ) ;
2007-04-01 18:36:23 +00:00
// setup 'Settings' menu
2017-11-21 09:52:14 +00:00
KToggleAction * showMenuBar = KStandardAction : : showMenubar ( nullptr , nullptr , actionCollection ( ) ) ;
2019-06-23 19:19:49 +00:00
showMenuBar - > setWhatsThis ( xi18nc ( " @info:whatsthis " ,
2022-06-09 21:23:29 +00:00
" <para>This switches between having a <emphasis>Menubar</emphasis> "
" and having a <interface>%1</interface> button. Both "
" contain mostly the same actions and configuration options.</para> "
" <para>The Menubar takes up more space but allows for fast and organised access to all "
" actions an application has to offer.</para><para>The <interface>%1</interface> button "
" is simpler and small which makes triggering advanced actions more time consuming.</para> " , hamburgerMenuAction - > text ( ) . replace ( ' & ' , " " ) ) ) ;
2014-04-10 14:53:41 +00:00
connect ( showMenuBar , & KToggleAction : : triggered , // Fixes #286822
this , & DolphinMainWindow : : toggleShowMenuBar , Qt : : QueuedConnection ) ;
2022-07-05 19:02:56 +00:00
KToggleAction * showStatusBar = KStandardAction : : showStatusbar ( nullptr , nullptr , actionCollection ( ) ) ;
showStatusBar - > setChecked ( GeneralSettings : : showStatusBar ( ) ) ;
connect ( GeneralSettings : : self ( ) , & GeneralSettings : : showStatusBarChanged , showStatusBar , & KToggleAction : : setChecked ) ;
connect ( showStatusBar , & KToggleAction : : triggered , this , [ this ] ( bool checked ) {
GeneralSettings : : setShowStatusBar ( checked ) ;
refreshViews ( ) ;
} ) ;
2022-01-25 17:33:01 +00:00
KStandardAction : : keyBindings ( this , & DolphinMainWindow : : slotKeyBindings , actionCollection ( ) ) ;
2018-02-03 19:30:37 +00:00
KStandardAction : : preferences ( this , & DolphinMainWindow : : editSettings , actionCollection ( ) ) ;
2008-10-25 09:00:28 +00:00
// not in menu actions
2014-11-03 23:00:04 +00:00
QList < QKeySequence > nextTabKeys = KStandardShortcut : : tabNext ( ) ;
2020-12-09 06:55:44 +00:00
nextTabKeys . append ( QKeySequence ( Qt : : CTRL | Qt : : Key_Tab ) ) ;
2010-03-22 18:48:12 +00:00
2014-11-03 23:00:04 +00:00
QList < QKeySequence > prevTabKeys = KStandardShortcut : : tabPrev ( ) ;
2020-12-09 06:55:44 +00:00
prevTabKeys . append ( QKeySequence ( Qt : : CTRL | Qt : : SHIFT | Qt : : Key_Tab ) ) ;
2010-03-22 18:48:12 +00:00
2019-10-13 14:37:00 +00:00
for ( int i = 0 ; i < MaxActivateTabShortcuts ; + + i ) {
QAction * activateTab = actionCollection ( ) - > addAction ( QStringLiteral ( " activate_tab_%1 " ) . arg ( i ) ) ;
activateTab - > setText ( i18nc ( " @action:inmenu " , " Activate Tab %1 " , i + 1 ) ) ;
activateTab - > setEnabled ( false ) ;
connect ( activateTab , & QAction : : triggered , this , [ this , i ] ( ) { m_tabWidget - > activateTab ( i ) ; } ) ;
// only add default shortcuts for the first 9 tabs regardless of MaxActivateTabShortcuts
if ( i < 9 ) {
actionCollection ( ) - > setDefaultShortcut ( activateTab , QStringLiteral ( " Alt+%1 " ) . arg ( i + 1 ) ) ;
}
}
QAction * activateLastTab = actionCollection ( ) - > addAction ( QStringLiteral ( " activate_last_tab " ) ) ;
activateLastTab - > setText ( i18nc ( " @action:inmenu " , " Activate Last Tab " ) ) ;
activateLastTab - > setEnabled ( false ) ;
connect ( activateLastTab , & QAction : : triggered , m_tabWidget , & DolphinTabWidget : : activateLastTab ) ;
2020-12-09 06:55:44 +00:00
actionCollection ( ) - > setDefaultShortcut ( activateLastTab , Qt : : ALT | Qt : : Key_0 ) ;
2019-10-13 14:37:00 +00:00
2016-03-16 21:17:37 +00:00
QAction * activateNextTab = actionCollection ( ) - > addAction ( QStringLiteral ( " activate_next_tab " ) ) ;
2014-04-29 19:54:33 +00:00
activateNextTab - > setIconText ( i18nc ( " @action:inmenu " , " Next Tab " ) ) ;
2008-10-25 09:21:20 +00:00
activateNextTab - > setText ( i18nc ( " @action:inmenu " , " Activate Next Tab " ) ) ;
2014-04-26 10:28:42 +00:00
activateNextTab - > setEnabled ( false ) ;
2014-08-22 21:17:02 +00:00
connect ( activateNextTab , & QAction : : triggered , m_tabWidget , & DolphinTabWidget : : activateNextTab ) ;
2016-10-12 11:31:35 +00:00
actionCollection ( ) - > setDefaultShortcuts ( activateNextTab , nextTabKeys ) ;
2008-10-25 09:00:28 +00:00
2016-03-16 21:17:37 +00:00
QAction * activatePrevTab = actionCollection ( ) - > addAction ( QStringLiteral ( " activate_prev_tab " ) ) ;
2014-04-29 19:54:33 +00:00
activatePrevTab - > setIconText ( i18nc ( " @action:inmenu " , " Previous Tab " ) ) ;
2008-10-25 09:21:20 +00:00
activatePrevTab - > setText ( i18nc ( " @action:inmenu " , " Activate Previous Tab " ) ) ;
2014-04-26 10:28:42 +00:00
activatePrevTab - > setEnabled ( false ) ;
2014-08-22 21:17:02 +00:00
connect ( activatePrevTab , & QAction : : triggered , m_tabWidget , & DolphinTabWidget : : activatePrevTab ) ;
2016-10-12 11:31:35 +00:00
actionCollection ( ) - > setDefaultShortcuts ( activatePrevTab , prevTabKeys ) ;
2008-10-25 10:32:55 +00:00
// for context menu
2018-03-18 10:55:24 +00:00
QAction * showTarget = actionCollection ( ) - > addAction ( QStringLiteral ( " show_target " ) ) ;
showTarget - > setText ( i18nc ( " @action:inmenu " , " Show Target " ) ) ;
showTarget - > setIcon ( QIcon : : fromTheme ( QStringLiteral ( " document-open-folder " ) ) ) ;
showTarget - > setEnabled ( false ) ;
connect ( showTarget , & QAction : : triggered , this , & DolphinMainWindow : : showTarget ) ;
2018-03-03 13:36:44 +00:00
2016-03-16 21:17:37 +00:00
QAction * openInNewTab = actionCollection ( ) - > addAction ( QStringLiteral ( " open_in_new_tab " ) ) ;
2008-10-25 10:32:55 +00:00
openInNewTab - > setText ( i18nc ( " @action:inmenu " , " Open in New Tab " ) ) ;
2016-03-16 21:17:37 +00:00
openInNewTab - > setIcon ( QIcon : : fromTheme ( QStringLiteral ( " tab-new " ) ) ) ;
2014-04-10 14:53:41 +00:00
connect ( openInNewTab , & QAction : : triggered , this , & DolphinMainWindow : : openInNewTab ) ;
2013-05-22 19:47:14 +00:00
2016-03-16 21:17:37 +00:00
QAction * openInNewTabs = actionCollection ( ) - > addAction ( QStringLiteral ( " open_in_new_tabs " ) ) ;
2013-05-22 19:47:14 +00:00
openInNewTabs - > setText ( i18nc ( " @action:inmenu " , " Open in New Tabs " ) ) ;
2016-03-16 21:17:37 +00:00
openInNewTabs - > setIcon ( QIcon : : fromTheme ( QStringLiteral ( " tab-new " ) ) ) ;
2014-04-10 14:53:41 +00:00
connect ( openInNewTabs , & QAction : : triggered , this , & DolphinMainWindow : : openInNewTab ) ;
2008-12-12 06:55:26 +00:00
2016-03-16 21:17:37 +00:00
QAction * openInNewWindow = actionCollection ( ) - > addAction ( QStringLiteral ( " open_in_new_window " ) ) ;
2008-10-25 10:32:55 +00:00
openInNewWindow - > setText ( i18nc ( " @action:inmenu " , " Open in New Window " ) ) ;
2016-03-16 21:17:37 +00:00
openInNewWindow - > setIcon ( QIcon : : fromTheme ( QStringLiteral ( " window-new " ) ) ) ;
2014-04-10 14:53:41 +00:00
connect ( openInNewWindow , & QAction : : triggered , this , & DolphinMainWindow : : openInNewWindow ) ;
2007-04-01 18:36:23 +00:00
}
void DolphinMainWindow : : setupDockWidgets ( )
{
2011-11-06 10:58:48 +00:00
const bool lock = GeneralSettings : : lockPanels ( ) ;
2010-12-31 10:59:46 +00:00
2022-01-28 18:40:11 +00:00
DolphinPlacesModelSingleton : : instance ( ) . placesModel ( ) - > setPanelsLocked ( lock ) ;
2016-03-16 21:17:37 +00:00
KDualAction * lockLayoutAction = actionCollection ( ) - > add < KDualAction > ( QStringLiteral ( " lock_panels " ) ) ;
2010-12-31 10:59:46 +00:00
lockLayoutAction - > setActiveText ( i18nc ( " @action:inmenu Panels " , " Unlock Panels " ) ) ;
2016-03-16 21:17:37 +00:00
lockLayoutAction - > setActiveIcon ( QIcon : : fromTheme ( QStringLiteral ( " object-unlocked " ) ) ) ;
2010-12-31 10:59:46 +00:00
lockLayoutAction - > setInactiveText ( i18nc ( " @action:inmenu Panels " , " Lock Panels " ) ) ;
2016-03-16 21:17:37 +00:00
lockLayoutAction - > setInactiveIcon ( QIcon : : fromTheme ( QStringLiteral ( " object-locked " ) ) ) ;
2019-06-23 19:19:49 +00:00
lockLayoutAction - > setWhatsThis ( xi18nc ( " @info:whatsthis " , " This "
" switches between having panels <emphasis>locked</emphasis> or "
" <emphasis>unlocked</emphasis>.<nl/>Unlocked panels can be "
" dragged to the other side of the window and have a close "
" button.<nl/>Locked panels are embedded more cleanly. " ) ) ;
2010-12-31 10:59:46 +00:00
lockLayoutAction - > setActive ( lock ) ;
2014-04-10 14:53:41 +00:00
connect ( lockLayoutAction , & KDualAction : : triggered , this , & DolphinMainWindow : : togglePanelLockState ) ;
2010-12-31 10:59:46 +00:00
// Setup "Information"
DolphinDockWidget * infoDock = new DolphinDockWidget ( i18nc ( " @title:window " , " Information " ) ) ;
infoDock - > setLocked ( lock ) ;
2016-03-16 21:17:37 +00:00
infoDock - > setObjectName ( QStringLiteral ( " infoDock " ) ) ;
2007-04-01 18:36:23 +00:00
infoDock - > setAllowedAreas ( Qt : : LeftDockWidgetArea | Qt : : RightDockWidgetArea ) ;
2018-08-13 21:36:35 +00:00
2022-06-11 17:16:13 +00:00
# if HAVE_BALOO
2014-04-10 14:53:41 +00:00
InformationPanel * infoPanel = new InformationPanel ( infoDock ) ;
2014-11-10 07:45:38 +00:00
infoPanel - > setCustomContextMenuActions ( { lockLayoutAction } ) ;
2014-04-10 14:53:41 +00:00
connect ( infoPanel , & InformationPanel : : urlActivated , this , & DolphinMainWindow : : handleUrl ) ;
2009-01-14 20:14:36 +00:00
infoDock - > setWidget ( infoPanel ) ;
2007-04-01 18:36:23 +00:00
2010-05-03 17:46:34 +00:00
QAction * infoAction = infoDock - > toggleViewAction ( ) ;
2016-03-16 21:17:37 +00:00
createPanelAction ( QIcon : : fromTheme ( QStringLiteral ( " dialog-information " ) ) , Qt : : Key_F11 , infoAction , QStringLiteral ( " show_information_panel " ) ) ;
2007-04-01 18:36:23 +00:00
addDockWidget ( Qt : : RightDockWidgetArea , infoDock ) ;
2014-04-10 14:53:41 +00:00
connect ( this , & DolphinMainWindow : : urlChanged ,
infoPanel , & InformationPanel : : setUrl ) ;
connect ( this , & DolphinMainWindow : : selectionChanged ,
infoPanel , & InformationPanel : : setSelection ) ;
connect ( this , & DolphinMainWindow : : requestItemInfo ,
infoPanel , & InformationPanel : : requestDelayedItemInfo ) ;
2021-04-24 09:00:31 +00:00
connect ( this , & DolphinMainWindow : : fileItemsChanged ,
infoPanel , & InformationPanel : : slotFilesItemChanged ) ;
2018-08-13 21:36:35 +00:00
# endif
2007-04-01 18:36:23 +00:00
2019-06-23 19:19:49 +00:00
// i18n: This is the last paragraph for the "What's This"-texts of all four panels.
const QString panelWhatsThis = xi18nc ( " @info:whatsthis " , " <para>To show or "
2022-06-09 21:23:29 +00:00
" hide panels like this go to <interface>Menu|Panels</interface> "
2019-06-23 19:19:49 +00:00
" or <interface>View|Panels</interface>.</para> " ) ;
2022-06-11 17:16:13 +00:00
# if HAVE_BALOO
2019-06-23 19:19:49 +00:00
actionCollection ( ) - > action ( QStringLiteral ( " show_information_panel " ) )
- > setWhatsThis ( xi18nc ( " @info:whatsthis " , " <para> This toggles the "
" <emphasis>information</emphasis> panel at the right side of the "
" window.</para><para>The panel provides in-depth information "
" about the items your mouse is hovering over or about the selected "
" items. Otherwise it informs you about the currently viewed folder.<nl/> "
" For single items a preview of their contents is provided.</para> " ) ) ;
2019-06-25 13:26:59 +00:00
# endif
2019-06-23 19:19:49 +00:00
infoDock - > setWhatsThis ( xi18nc ( " @info:whatsthis " , " <para>This panel "
" provides in-depth information about the items your mouse is "
" hovering over or about the selected items. Otherwise it informs "
" you about the currently viewed folder.<nl/>For single items a "
" preview of their contents is provided.</para><para>You can configure "
" which and how details are given here by right-clicking.</para> " ) + panelWhatsThis ) ;
2010-12-31 10:59:46 +00:00
// Setup "Folders"
DolphinDockWidget * foldersDock = new DolphinDockWidget ( i18nc ( " @title:window " , " Folders " ) ) ;
foldersDock - > setLocked ( lock ) ;
2016-03-16 21:17:37 +00:00
foldersDock - > setObjectName ( QStringLiteral ( " foldersDock " ) ) ;
2009-01-14 20:14:36 +00:00
foldersDock - > setAllowedAreas ( Qt : : LeftDockWidgetArea | Qt : : RightDockWidgetArea ) ;
FoldersPanel * foldersPanel = new FoldersPanel ( foldersDock ) ;
2014-11-10 07:45:38 +00:00
foldersPanel - > setCustomContextMenuActions ( { lockLayoutAction } ) ;
2009-01-14 20:14:36 +00:00
foldersDock - > setWidget ( foldersPanel ) ;
2007-04-01 18:36:23 +00:00
2010-05-03 17:46:34 +00:00
QAction * foldersAction = foldersDock - > toggleViewAction ( ) ;
2016-03-16 21:17:37 +00:00
createPanelAction ( QIcon : : fromTheme ( QStringLiteral ( " folder " ) ) , Qt : : Key_F7 , foldersAction , QStringLiteral ( " show_folders_panel " ) ) ;
2007-04-01 18:36:23 +00:00
2009-01-14 20:14:36 +00:00
addDockWidget ( Qt : : LeftDockWidgetArea , foldersDock ) ;
2014-04-10 14:53:41 +00:00
connect ( this , & DolphinMainWindow : : urlChanged ,
foldersPanel , & FoldersPanel : : setUrl ) ;
connect ( foldersPanel , & FoldersPanel : : folderActivated ,
this , & DolphinMainWindow : : changeUrl ) ;
2021-12-17 14:11:46 +00:00
connect ( foldersPanel , & FoldersPanel : : folderInNewTab ,
2020-12-12 13:17:23 +00:00
this , & DolphinMainWindow : : openNewTab ) ;
2021-12-17 14:11:46 +00:00
connect ( foldersPanel , & FoldersPanel : : folderInNewActiveTab ,
this , & DolphinMainWindow : : openNewTabAndActivate ) ;
2014-04-10 14:53:41 +00:00
connect ( foldersPanel , & FoldersPanel : : errorMessage ,
2015-01-24 23:14:37 +00:00
this , & DolphinMainWindow : : showErrorMessage ) ;
2007-04-01 18:36:23 +00:00
2019-06-23 19:19:49 +00:00
actionCollection ( ) - > action ( QStringLiteral ( " show_folders_panel " ) )
- > setWhatsThis ( xi18nc ( " @info:whatsthis " , " This toggles the "
" <emphasis>folders</emphasis> panel at the left side of the window. "
" <nl/><nl/>It shows the folders of the <emphasis>file system "
" </emphasis> in a <emphasis>tree view</emphasis>. " ) ) ;
foldersDock - > setWhatsThis ( xi18nc ( " @info:whatsthis " , " <para>This panel "
" shows the folders of the <emphasis>file system</emphasis> in a "
" <emphasis>tree view</emphasis>.</para><para>Click a folder to go "
" there. Click the arrow to the left of a folder to see its subfolders. "
" This allows quick switching between any folders.</para> " ) + panelWhatsThis ) ;
2010-12-31 10:59:46 +00:00
// Setup "Terminal"
2022-06-11 17:16:13 +00:00
# if HAVE_TERMINAL
2016-05-26 12:51:23 +00:00
if ( KAuthorized : : authorize ( QStringLiteral ( " shell_access " ) ) ) {
2016-05-18 01:06:49 +00:00
DolphinDockWidget * terminalDock = new DolphinDockWidget ( i18nc ( " @title:window Shell terminal " , " Terminal " ) ) ;
terminalDock - > setLocked ( lock ) ;
terminalDock - > setObjectName ( QStringLiteral ( " terminalDock " ) ) ;
2017-10-12 21:17:51 +00:00
m_terminalPanel = new TerminalPanel ( terminalDock ) ;
m_terminalPanel - > setCustomContextMenuActions ( { lockLayoutAction } ) ;
terminalDock - > setWidget ( m_terminalPanel ) ;
2016-05-18 01:06:49 +00:00
2017-10-12 21:17:51 +00:00
connect ( m_terminalPanel , & TerminalPanel : : hideTerminalPanel , terminalDock , & DolphinDockWidget : : hide ) ;
connect ( m_terminalPanel , & TerminalPanel : : changeUrl , this , & DolphinMainWindow : : slotTerminalDirectoryChanged ) ;
2016-05-18 01:06:49 +00:00
connect ( terminalDock , & DolphinDockWidget : : visibilityChanged ,
2017-10-12 21:17:51 +00:00
m_terminalPanel , & TerminalPanel : : dockVisibilityChanged ) ;
2018-01-18 17:49:54 +00:00
connect ( terminalDock , & DolphinDockWidget : : visibilityChanged ,
this , & DolphinMainWindow : : slotTerminalPanelVisibilityChanged ) ;
2016-05-18 01:06:49 +00:00
QAction * terminalAction = terminalDock - > toggleViewAction ( ) ;
2019-09-05 15:30:06 +00:00
createPanelAction ( QIcon : : fromTheme ( QStringLiteral ( " dialog-scripts " ) ) , Qt : : Key_F4 , terminalAction , QStringLiteral ( " show_terminal_panel " ) ) ;
2016-05-18 01:06:49 +00:00
addDockWidget ( Qt : : BottomDockWidgetArea , terminalDock ) ;
connect ( this , & DolphinMainWindow : : urlChanged ,
2017-10-12 21:17:51 +00:00
m_terminalPanel , & TerminalPanel : : setUrl ) ;
2016-05-18 01:06:49 +00:00
if ( GeneralSettings : : version ( ) < 200 ) {
terminalDock - > hide ( ) ;
}
2019-06-23 19:19:49 +00:00
actionCollection ( ) - > action ( QStringLiteral ( " show_terminal_panel " ) )
- > setWhatsThis ( xi18nc ( " @info:whatsthis " , " <para>This toggles the "
" <emphasis>terminal</emphasis> panel at the bottom of the window. "
" <nl/>The location in the terminal will always match the folder "
" view so you can navigate using either.</para><para>The terminal "
" panel is not needed for basic computer usage but can be useful "
" for advanced tasks. To learn more about terminals use the help "
" in a standalone terminal application like Konsole.</para> " ) ) ;
terminalDock - > setWhatsThis ( xi18nc ( " @info:whatsthis " , " <para>This is "
" the <emphasis>terminal</emphasis> panel. It behaves like a "
" normal terminal but will match the location of the folder view "
" so you can navigate using either.</para><para>The terminal panel "
" is not needed for basic computer usage but can be useful for "
" advanced tasks. To learn more about terminals use the help in a "
" standalone terminal application like Konsole.</para> " ) + panelWhatsThis ) ;
2016-05-18 01:06:49 +00:00
}
2008-03-10 17:33:30 +00:00
# endif
2008-03-12 16:58:11 +00:00
2011-11-06 10:58:48 +00:00
if ( GeneralSettings : : version ( ) < 200 ) {
2010-06-16 21:13:41 +00:00
infoDock - > hide ( ) ;
2009-01-14 20:14:36 +00:00
foldersDock - > hide ( ) ;
2011-08-14 13:30:29 +00:00
}
2007-04-01 22:28:03 +00:00
2010-12-31 10:59:46 +00:00
// Setup "Places"
DolphinDockWidget * placesDock = new DolphinDockWidget ( i18nc ( " @title:window " , " Places " ) ) ;
placesDock - > setLocked ( lock ) ;
2016-03-16 21:17:37 +00:00
placesDock - > setObjectName ( QStringLiteral ( " placesDock " ) ) ;
2007-04-01 22:28:03 +00:00
placesDock - > setAllowedAreas ( Qt : : LeftDockWidgetArea | Qt : : RightDockWidgetArea ) ;
2008-01-30 22:22:46 +00:00
2017-10-12 21:17:51 +00:00
m_placesPanel = new PlacesPanel ( placesDock ) ;
m_placesPanel - > setCustomContextMenuActions ( { lockLayoutAction } ) ;
placesDock - > setWidget ( m_placesPanel ) ;
2007-04-14 16:50:51 +00:00
2017-10-12 21:17:51 +00:00
QAction * placesAction = placesDock - > toggleViewAction ( ) ;
2020-12-29 14:22:57 +00:00
createPanelAction ( QIcon : : fromTheme ( QStringLiteral ( " compass " ) ) , Qt : : Key_F9 , placesAction , QStringLiteral ( " show_places_panel " ) ) ;
2007-04-14 16:50:51 +00:00
2007-04-01 22:28:03 +00:00
addDockWidget ( Qt : : LeftDockWidgetArea , placesDock ) ;
2017-10-12 21:17:51 +00:00
connect ( m_placesPanel , & PlacesPanel : : placeActivated ,
2014-04-10 14:53:41 +00:00
this , & DolphinMainWindow : : slotPlaceActivated ) ;
2021-12-16 18:29:22 +00:00
connect ( m_placesPanel , & PlacesPanel : : tabRequested ,
2020-12-12 13:17:23 +00:00
this , & DolphinMainWindow : : openNewTab ) ;
2021-12-16 18:29:22 +00:00
connect ( m_placesPanel , & PlacesPanel : : activeTabRequested ,
2021-12-17 14:11:46 +00:00
this , & DolphinMainWindow : : openNewTabAndActivate ) ;
2021-12-16 18:29:22 +00:00
connect ( m_placesPanel , & PlacesPanel : : newWindowRequested , this , [ this ] ( const QUrl & url ) {
Dolphin : : openNewWindow ( { url } , this ) ;
} ) ;
2017-10-12 21:17:51 +00:00
connect ( m_placesPanel , & PlacesPanel : : errorMessage ,
2015-01-24 23:14:37 +00:00
this , & DolphinMainWindow : : showErrorMessage ) ;
2014-04-10 14:53:41 +00:00
connect ( this , & DolphinMainWindow : : urlChanged ,
2017-10-12 21:17:51 +00:00
m_placesPanel , & PlacesPanel : : setUrl ) ;
2014-04-10 14:53:41 +00:00
connect ( placesDock , & DolphinDockWidget : : visibilityChanged ,
2020-11-05 22:30:07 +00:00
& DolphinUrlNavigatorsController : : slotPlacesPanelVisibilityChanged ) ;
2014-04-10 14:53:41 +00:00
connect ( this , & DolphinMainWindow : : settingsChanged ,
2017-10-12 21:17:51 +00:00
m_placesPanel , & PlacesPanel : : readSettings ) ;
connect ( m_placesPanel , & PlacesPanel : : storageTearDownRequested ,
this , & DolphinMainWindow : : slotStorageTearDownFromPlacesRequested ) ;
connect ( m_placesPanel , & PlacesPanel : : storageTearDownExternallyRequested ,
this , & DolphinMainWindow : : slotStorageTearDownExternallyRequested ) ;
2020-11-05 22:30:07 +00:00
DolphinUrlNavigatorsController : : slotPlacesPanelVisibilityChanged ( m_placesPanel - > isVisible ( ) ) ;
2014-08-10 16:52:06 +00:00
2019-09-04 15:04:13 +00:00
auto actionShowAllPlaces = new QAction ( QIcon : : fromTheme ( QStringLiteral ( " view-hidden " ) ) , i18nc ( " @item:inmenu " , " Show Hidden Places " ) , this ) ;
Improve Ux for the places panel's hidden items
Summary:
BUG: 400860
FIXED-IN: 18.12.0
Clean up the context menu for the places panel.
- Change Text "Show All Entries" -> "Show Hidden Places"
- Use State dependent icon (like hidden files)
- Disable instead of hide if not places are hidden.
- Toggle to unchecked if last item of group is unhidden.
Create a copy of this "Show Hidden Places" entry in the main dolphin menu View->Places.
Test Plan:
With Hidden Places
{F6398756}
{F6398759}
Context Menu:
{F6398762}
{F6398761}
Without Hidden Places.
{F6414694}
{F6414696}
Reviewers: #dolphin, #vdg, elvisangelaccio, ngraham
Reviewed By: #dolphin, #vdg, elvisangelaccio, ngraham
Subscribers: cfeck, elvisangelaccio, veqz, davidc, ngraham, kfm-devel
Tags: #dolphin
Maniphest Tasks: T8349
Differential Revision: https://phabricator.kde.org/D16767
2018-11-11 21:02:08 +00:00
actionShowAllPlaces - > setCheckable ( true ) ;
actionShowAllPlaces - > setDisabled ( true ) ;
2019-06-23 19:19:49 +00:00
actionShowAllPlaces - > setWhatsThis ( i18nc ( " @info:whatsthis " , " This displays "
" all places in the places panel that have been hidden. They will "
" appear semi-transparent unless you uncheck their hide property. " ) ) ;
Improve Ux for the places panel's hidden items
Summary:
BUG: 400860
FIXED-IN: 18.12.0
Clean up the context menu for the places panel.
- Change Text "Show All Entries" -> "Show Hidden Places"
- Use State dependent icon (like hidden files)
- Disable instead of hide if not places are hidden.
- Toggle to unchecked if last item of group is unhidden.
Create a copy of this "Show Hidden Places" entry in the main dolphin menu View->Places.
Test Plan:
With Hidden Places
{F6398756}
{F6398759}
Context Menu:
{F6398762}
{F6398761}
Without Hidden Places.
{F6414694}
{F6414696}
Reviewers: #dolphin, #vdg, elvisangelaccio, ngraham
Reviewed By: #dolphin, #vdg, elvisangelaccio, ngraham
Subscribers: cfeck, elvisangelaccio, veqz, davidc, ngraham, kfm-devel
Tags: #dolphin
Maniphest Tasks: T8349
Differential Revision: https://phabricator.kde.org/D16767
2018-11-11 21:02:08 +00:00
connect ( actionShowAllPlaces , & QAction : : triggered , this , [ actionShowAllPlaces , this ] ( bool checked ) {
2021-12-16 18:29:22 +00:00
m_placesPanel - > setShowAll ( checked ) ;
Improve Ux for the places panel's hidden items
Summary:
BUG: 400860
FIXED-IN: 18.12.0
Clean up the context menu for the places panel.
- Change Text "Show All Entries" -> "Show Hidden Places"
- Use State dependent icon (like hidden files)
- Disable instead of hide if not places are hidden.
- Toggle to unchecked if last item of group is unhidden.
Create a copy of this "Show Hidden Places" entry in the main dolphin menu View->Places.
Test Plan:
With Hidden Places
{F6398756}
{F6398759}
Context Menu:
{F6398762}
{F6398761}
Without Hidden Places.
{F6414694}
{F6414696}
Reviewers: #dolphin, #vdg, elvisangelaccio, ngraham
Reviewed By: #dolphin, #vdg, elvisangelaccio, ngraham
Subscribers: cfeck, elvisangelaccio, veqz, davidc, ngraham, kfm-devel
Tags: #dolphin
Maniphest Tasks: T8349
Differential Revision: https://phabricator.kde.org/D16767
2018-11-11 21:02:08 +00:00
} ) ;
2021-12-16 18:29:22 +00:00
connect ( m_placesPanel , & PlacesPanel : : allPlacesShownChanged , actionShowAllPlaces , & QAction : : setChecked ) ;
Improve Ux for the places panel's hidden items
Summary:
BUG: 400860
FIXED-IN: 18.12.0
Clean up the context menu for the places panel.
- Change Text "Show All Entries" -> "Show Hidden Places"
- Use State dependent icon (like hidden files)
- Disable instead of hide if not places are hidden.
- Toggle to unchecked if last item of group is unhidden.
Create a copy of this "Show Hidden Places" entry in the main dolphin menu View->Places.
Test Plan:
With Hidden Places
{F6398756}
{F6398759}
Context Menu:
{F6398762}
{F6398761}
Without Hidden Places.
{F6414694}
{F6414696}
Reviewers: #dolphin, #vdg, elvisangelaccio, ngraham
Reviewed By: #dolphin, #vdg, elvisangelaccio, ngraham
Subscribers: cfeck, elvisangelaccio, veqz, davidc, ngraham, kfm-devel
Tags: #dolphin
Maniphest Tasks: T8349
Differential Revision: https://phabricator.kde.org/D16767
2018-11-11 21:02:08 +00:00
2019-06-23 19:19:49 +00:00
actionCollection ( ) - > action ( QStringLiteral ( " show_places_panel " ) )
- > setWhatsThis ( xi18nc ( " @info:whatsthis " , " <para>This toggles the "
" <emphasis>places</emphasis> panel at the left side of the window. "
" </para><para>It allows you to go to locations you have "
" bookmarked and to access disk or media attached to the computer "
" or to the network. It also contains sections to find recently "
" saved files or files of a certain type.</para> " ) ) ;
placesDock - > setWhatsThis ( xi18nc ( " @info:whatsthis " , " <para>This is the "
" <emphasis>Places</emphasis> panel. It allows you to go to locations "
" you have bookmarked and to access disk or media attached to the "
" computer or to the network. It also contains sections to find "
" recently saved files or files of a certain type.</para><para> "
" Click on an entry to go there. Click with the right mouse button "
" instead to open any entry in a new tab or new window.</para> "
" <para>New entries can be added by dragging folders onto this panel. "
" Right-click any section or entry to hide it. Right-click an empty "
" space on this panel and select <interface>Show Hidden Places "
" </interface> to display it again.</para> " ) + panelWhatsThis ) ;
2010-12-31 10:59:46 +00:00
// Add actions into the "Panels" menu
2019-09-14 14:40:06 +00:00
KActionMenu * panelsMenu = new KActionMenu ( i18nc ( " @action:inmenu View " , " Show Panels " ) , this ) ;
2016-03-16 21:17:37 +00:00
actionCollection ( ) - > addAction ( QStringLiteral ( " panels " ) , panelsMenu ) ;
2019-09-14 14:40:06 +00:00
panelsMenu - > setIcon ( QIcon : : fromTheme ( QStringLiteral ( " view-sidetree " ) ) ) ;
2020-12-06 18:47:07 +00:00
panelsMenu - > setPopupMode ( QToolButton : : InstantPopup ) ;
2011-11-21 10:04:45 +00:00
const KActionCollection * ac = actionCollection ( ) ;
2016-03-16 21:17:37 +00:00
panelsMenu - > addAction ( ac - > action ( QStringLiteral ( " show_places_panel " ) ) ) ;
2022-06-11 17:16:13 +00:00
# if HAVE_BALOO
2016-03-16 21:17:37 +00:00
panelsMenu - > addAction ( ac - > action ( QStringLiteral ( " show_information_panel " ) ) ) ;
2018-08-22 21:48:53 +00:00
# endif
2016-03-16 21:17:37 +00:00
panelsMenu - > addAction ( ac - > action ( QStringLiteral ( " show_folders_panel " ) ) ) ;
panelsMenu - > addAction ( ac - > action ( QStringLiteral ( " show_terminal_panel " ) ) ) ;
2010-12-31 10:59:46 +00:00
panelsMenu - > addSeparator ( ) ;
Improve Ux for the places panel's hidden items
Summary:
BUG: 400860
FIXED-IN: 18.12.0
Clean up the context menu for the places panel.
- Change Text "Show All Entries" -> "Show Hidden Places"
- Use State dependent icon (like hidden files)
- Disable instead of hide if not places are hidden.
- Toggle to unchecked if last item of group is unhidden.
Create a copy of this "Show Hidden Places" entry in the main dolphin menu View->Places.
Test Plan:
With Hidden Places
{F6398756}
{F6398759}
Context Menu:
{F6398762}
{F6398761}
Without Hidden Places.
{F6414694}
{F6414696}
Reviewers: #dolphin, #vdg, elvisangelaccio, ngraham
Reviewed By: #dolphin, #vdg, elvisangelaccio, ngraham
Subscribers: cfeck, elvisangelaccio, veqz, davidc, ngraham, kfm-devel
Tags: #dolphin
Maniphest Tasks: T8349
Differential Revision: https://phabricator.kde.org/D16767
2018-11-11 21:02:08 +00:00
panelsMenu - > addAction ( actionShowAllPlaces ) ;
2010-12-31 10:59:46 +00:00
panelsMenu - > addAction ( lockLayoutAction ) ;
Improve Ux for the places panel's hidden items
Summary:
BUG: 400860
FIXED-IN: 18.12.0
Clean up the context menu for the places panel.
- Change Text "Show All Entries" -> "Show Hidden Places"
- Use State dependent icon (like hidden files)
- Disable instead of hide if not places are hidden.
- Toggle to unchecked if last item of group is unhidden.
Create a copy of this "Show Hidden Places" entry in the main dolphin menu View->Places.
Test Plan:
With Hidden Places
{F6398756}
{F6398759}
Context Menu:
{F6398762}
{F6398761}
Without Hidden Places.
{F6414694}
{F6414696}
Reviewers: #dolphin, #vdg, elvisangelaccio, ngraham
Reviewed By: #dolphin, #vdg, elvisangelaccio, ngraham
Subscribers: cfeck, elvisangelaccio, veqz, davidc, ngraham, kfm-devel
Tags: #dolphin
Maniphest Tasks: T8349
Differential Revision: https://phabricator.kde.org/D16767
2018-11-11 21:02:08 +00:00
connect ( panelsMenu - > menu ( ) , & QMenu : : aboutToShow , this , [ actionShowAllPlaces , this ] {
2021-12-16 18:29:22 +00:00
actionShowAllPlaces - > setEnabled ( DolphinPlacesModelSingleton : : instance ( ) . placesModel ( ) - > hiddenCount ( ) ) ;
Improve Ux for the places panel's hidden items
Summary:
BUG: 400860
FIXED-IN: 18.12.0
Clean up the context menu for the places panel.
- Change Text "Show All Entries" -> "Show Hidden Places"
- Use State dependent icon (like hidden files)
- Disable instead of hide if not places are hidden.
- Toggle to unchecked if last item of group is unhidden.
Create a copy of this "Show Hidden Places" entry in the main dolphin menu View->Places.
Test Plan:
With Hidden Places
{F6398756}
{F6398759}
Context Menu:
{F6398762}
{F6398761}
Without Hidden Places.
{F6414694}
{F6414696}
Reviewers: #dolphin, #vdg, elvisangelaccio, ngraham
Reviewed By: #dolphin, #vdg, elvisangelaccio, ngraham
Subscribers: cfeck, elvisangelaccio, veqz, davidc, ngraham, kfm-devel
Tags: #dolphin
Maniphest Tasks: T8349
Differential Revision: https://phabricator.kde.org/D16767
2018-11-11 21:02:08 +00:00
} ) ;
2007-04-01 18:36:23 +00:00
}
2019-09-01 21:01:57 +00:00
void DolphinMainWindow : : updateFileAndEditActions ( )
2007-04-01 18:36:23 +00:00
{
2007-10-02 19:03:03 +00:00
const KFileItemList list = m_activeViewContainer - > view ( ) - > selectedItems ( ) ;
2019-09-01 21:01:57 +00:00
const KActionCollection * col = actionCollection ( ) ;
Allow to copy or move selection to the other split view
Summary:
FEATURE: 276167
Default keyboard shortcuts set to `SHIFT+F5` for `copy`, `SHIFT+F6` for `move`
Reviewers: #dolphin, elvisangelaccio, ngraham, meven, dfaure
Reviewed By: #dolphin, elvisangelaccio, ngraham, meven, dfaure
Subscribers: yurchor, kde-doc-english, dfaure, meven, kfm-devel
Tags: #dolphin, #documentation
Differential Revision: https://phabricator.kde.org/D29006
2020-05-14 22:17:31 +00:00
KFileItemListProperties capabilitiesSource ( list ) ;
2021-09-12 13:33:39 +00:00
QAction * renameAction = col - > action ( KStandardAction : : name ( KStandardAction : : RenameFile ) ) ;
QAction * moveToTrashAction = col - > action ( KStandardAction : : name ( KStandardAction : : MoveToTrash ) ) ;
QAction * deleteAction = col - > action ( KStandardAction : : name ( KStandardAction : : DeleteFile ) ) ;
QAction * cutAction = col - > action ( KStandardAction : : name ( KStandardAction : : Cut ) ) ;
QAction * duplicateAction = col - > action ( QStringLiteral ( " duplicate " ) ) ; // see DolphinViewActionHandler
2022-04-24 11:18:30 +00:00
QAction * addToPlacesAction = col - > action ( QStringLiteral ( " add_to_places " ) ) ;
Allow to copy or move selection to the other split view
Summary:
FEATURE: 276167
Default keyboard shortcuts set to `SHIFT+F5` for `copy`, `SHIFT+F6` for `move`
Reviewers: #dolphin, elvisangelaccio, ngraham, meven, dfaure
Reviewed By: #dolphin, elvisangelaccio, ngraham, meven, dfaure
Subscribers: yurchor, kde-doc-english, dfaure, meven, kfm-devel
Tags: #dolphin, #documentation
Differential Revision: https://phabricator.kde.org/D29006
2020-05-14 22:17:31 +00:00
QAction * copyToOtherViewAction = col - > action ( QStringLiteral ( " copy_to_inactive_split_view " ) ) ;
QAction * moveToOtherViewAction = col - > action ( QStringLiteral ( " move_to_inactive_split_view " ) ) ;
2020-06-29 22:27:33 +00:00
QAction * copyLocation = col - > action ( QString ( " copy_location " ) ) ;
2019-09-01 21:01:57 +00:00
2007-04-01 18:36:23 +00:00
if ( list . isEmpty ( ) ) {
2016-03-16 21:17:37 +00:00
stateChanged ( QStringLiteral ( " has_no_selection " ) ) ;
2019-09-01 21:01:57 +00:00
2021-09-12 13:33:39 +00:00
// All actions that need a selection to function can be enabled because they should trigger selection mode.
renameAction - > setEnabled ( true ) ;
moveToTrashAction - > setEnabled ( true ) ;
deleteAction - > setEnabled ( true ) ;
cutAction - > setEnabled ( true ) ;
duplicateAction - > setEnabled ( true ) ;
2019-10-20 10:03:10 +00:00
addToPlacesAction - > setEnabled ( true ) ;
2021-09-12 13:33:39 +00:00
copyLocation - > setEnabled ( true ) ;
2022-04-24 11:18:30 +00:00
// Them triggering selection mode and not directly acting on selected items is signified by adding "…" to their text.
m_actionTextHelper - > textsWhenNothingIsSelectedEnabled ( true ) ;
2007-04-09 19:12:54 +00:00
} else {
2022-04-24 11:18:30 +00:00
m_actionTextHelper - > textsWhenNothingIsSelectedEnabled ( false ) ;
2016-03-16 21:17:37 +00:00
stateChanged ( QStringLiteral ( " has_selection " ) ) ;
2007-04-01 18:36:23 +00:00
2016-03-16 21:17:37 +00:00
QAction * deleteWithTrashShortcut = col - > action ( QStringLiteral ( " delete_shortcut " ) ) ; // see DolphinViewActionHandler
2018-03-18 10:55:24 +00:00
QAction * showTarget = col - > action ( QStringLiteral ( " show_target " ) ) ;
2008-06-01 18:44:35 +00:00
2019-09-01 21:01:57 +00:00
if ( list . length ( ) = = 1 & & list . first ( ) . isDir ( ) ) {
addToPlacesAction - > setEnabled ( true ) ;
} else {
addToPlacesAction - > setEnabled ( false ) ;
}
Allow to copy or move selection to the other split view
Summary:
FEATURE: 276167
Default keyboard shortcuts set to `SHIFT+F5` for `copy`, `SHIFT+F6` for `move`
Reviewers: #dolphin, elvisangelaccio, ngraham, meven, dfaure
Reviewed By: #dolphin, elvisangelaccio, ngraham, meven, dfaure
Subscribers: yurchor, kde-doc-english, dfaure, meven, kfm-devel
Tags: #dolphin, #documentation
Differential Revision: https://phabricator.kde.org/D29006
2020-05-14 22:17:31 +00:00
const bool enableMoveToTrash = capabilitiesSource . isLocal ( ) & & capabilitiesSource . supportsMoving ( ) ;
2008-06-01 18:44:35 +00:00
Allow to copy or move selection to the other split view
Summary:
FEATURE: 276167
Default keyboard shortcuts set to `SHIFT+F5` for `copy`, `SHIFT+F6` for `move`
Reviewers: #dolphin, elvisangelaccio, ngraham, meven, dfaure
Reviewed By: #dolphin, elvisangelaccio, ngraham, meven, dfaure
Subscribers: yurchor, kde-doc-english, dfaure, meven, kfm-devel
Tags: #dolphin, #documentation
Differential Revision: https://phabricator.kde.org/D29006
2020-05-14 22:17:31 +00:00
renameAction - > setEnabled ( capabilitiesSource . supportsMoving ( ) ) ;
2008-06-01 18:44:35 +00:00
moveToTrashAction - > setEnabled ( enableMoveToTrash ) ;
Allow to copy or move selection to the other split view
Summary:
FEATURE: 276167
Default keyboard shortcuts set to `SHIFT+F5` for `copy`, `SHIFT+F6` for `move`
Reviewers: #dolphin, elvisangelaccio, ngraham, meven, dfaure
Reviewed By: #dolphin, elvisangelaccio, ngraham, meven, dfaure
Subscribers: yurchor, kde-doc-english, dfaure, meven, kfm-devel
Tags: #dolphin, #documentation
Differential Revision: https://phabricator.kde.org/D29006
2020-05-14 22:17:31 +00:00
deleteAction - > setEnabled ( capabilitiesSource . supportsDeleting ( ) ) ;
deleteWithTrashShortcut - > setEnabled ( capabilitiesSource . supportsDeleting ( ) & & ! enableMoveToTrash ) ;
cutAction - > setEnabled ( capabilitiesSource . supportsMoving ( ) ) ;
2020-06-29 22:27:33 +00:00
copyLocation - > setEnabled ( list . length ( ) = = 1 ) ;
2018-03-18 10:55:24 +00:00
showTarget - > setEnabled ( list . length ( ) = = 1 & & list . at ( 0 ) . isLink ( ) ) ;
Allow to copy or move selection to the other split view
Summary:
FEATURE: 276167
Default keyboard shortcuts set to `SHIFT+F5` for `copy`, `SHIFT+F6` for `move`
Reviewers: #dolphin, elvisangelaccio, ngraham, meven, dfaure
Reviewed By: #dolphin, elvisangelaccio, ngraham, meven, dfaure
Subscribers: yurchor, kde-doc-english, dfaure, meven, kfm-devel
Tags: #dolphin, #documentation
Differential Revision: https://phabricator.kde.org/D29006
2020-05-14 22:17:31 +00:00
duplicateAction - > setEnabled ( capabilitiesSource . supportsWriting ( ) ) ;
2007-04-01 18:36:23 +00:00
}
2021-09-12 13:33:39 +00:00
if ( m_tabWidget - > currentTabPage ( ) - > splitViewEnabled ( ) ) {
DolphinTabPage * tabPage = m_tabWidget - > currentTabPage ( ) ;
KFileItem capabilitiesDestination ;
if ( tabPage - > primaryViewActive ( ) ) {
capabilitiesDestination = tabPage - > secondaryViewContainer ( ) - > url ( ) ;
} else {
capabilitiesDestination = tabPage - > primaryViewContainer ( ) - > url ( ) ;
}
copyToOtherViewAction - > setEnabled ( capabilitiesDestination . isWritable ( ) ) ;
moveToOtherViewAction - > setEnabled ( ( list . isEmpty ( ) | | capabilitiesSource . supportsMoving ( ) ) & & capabilitiesDestination . isWritable ( ) ) ;
} else {
copyToOtherViewAction - > setEnabled ( false ) ;
moveToOtherViewAction - > setEnabled ( false ) ;
}
2007-04-01 18:36:23 +00:00
}
void DolphinMainWindow : : updateViewActions ( )
{
2008-02-11 12:34:48 +00:00
m_actionHandler - > updateViewActions ( ) ;
2007-04-01 18:36:23 +00:00
2020-12-02 07:07:41 +00:00
QAction * toggleFilterBarAction = actionCollection ( ) - > action ( QStringLiteral ( " toggle_filter " ) ) ;
toggleFilterBarAction - > setChecked ( m_activeViewContainer - > isFilterBarVisible ( ) ) ;
2007-04-01 18:36:23 +00:00
2007-08-12 17:48:29 +00:00
updateSplitAction ( ) ;
2007-04-01 18:36:23 +00:00
}
void DolphinMainWindow : : updateGoActions ( )
{
2008-01-27 14:54:38 +00:00
QAction * goUpAction = actionCollection ( ) - > action ( KStandardAction : : name ( KStandardAction : : Up ) ) ;
2014-10-21 19:18:43 +00:00
const QUrl currentUrl = m_activeViewContainer - > url ( ) ;
2019-06-23 19:19:49 +00:00
// I think this is one of the best places to firstly be confronted
// with a file system and its hierarchy. Talking about the root
// directory might seem too much here but it is the question that
// naturally arises in this context.
goUpAction - > setWhatsThis ( xi18nc ( " @info:whatsthis " , " <para>Go to "
2019-06-24 05:40:39 +00:00
" the folder that contains the currently viewed one.</para> "
2019-06-23 19:19:49 +00:00
" <para>All files and folders are organized in a hierarchical "
" <emphasis>file system</emphasis>. At the top of this hierarchy is "
" a directory that contains all data connected to this computer "
" —the <emphasis>root directory</emphasis>.</para> " ) ) ;
2014-10-21 19:18:43 +00:00
goUpAction - > setEnabled ( KIO : : upUrl ( currentUrl ) ! = currentUrl ) ;
2007-04-01 18:36:23 +00:00
}
2011-04-15 18:52:27 +00:00
void DolphinMainWindow : : refreshViews ( )
{
2014-08-10 16:52:06 +00:00
m_tabWidget - > refreshViews ( ) ;
2011-04-15 18:52:27 +00:00
2011-11-06 10:58:48 +00:00
if ( GeneralSettings : : modifiedStartupSettings ( ) ) {
2018-07-28 15:29:00 +00:00
updateWindowTitle ( ) ;
2011-04-15 18:52:27 +00:00
}
2012-09-11 18:09:01 +00:00
2023-01-11 17:08:18 +00:00
updateSplitAction ( ) ;
2020-10-23 17:51:33 +00:00
Q_EMIT settingsChanged ( ) ;
2011-04-15 18:52:27 +00:00
}
2007-04-01 18:36:23 +00:00
void DolphinMainWindow : : clearStatusBar ( )
{
2012-04-12 21:57:51 +00:00
m_activeViewContainer - > statusBar ( ) - > resetToDefaultText ( ) ;
2007-04-01 18:36:23 +00:00
}
2008-04-12 15:09:46 +00:00
void DolphinMainWindow : : connectViewSignals ( DolphinViewContainer * container )
2007-04-01 18:36:23 +00:00
{
2014-04-10 14:53:41 +00:00
connect ( container , & DolphinViewContainer : : showFilterBarChanged ,
this , & DolphinMainWindow : : updateFilterBarAction ) ;
connect ( container , & DolphinViewContainer : : writeStateChanged ,
this , & DolphinMainWindow : : slotWriteStateChanged ) ;
[dolphin] Add an action to toggle the searchbar
Summary:
Make search action toggle the searchbar instead of just launching it.
The search action in dolphin did only bring up the search bar, but to close it again you had to go to the closing button on the same searchbar.
This behavior in inconsistent with other dolphin actions which toggle panels or tools.
BEFORE:
{F7256652}
AFTER:
{F7256862}
BUG: 344617
FIXED-IN: 19.12.0
Closes T8473
Depends on D23075
Test Plan:
- Enable the search mode: the searchbar appears and the toolbar button gets checked
- Press the search button again, and it goes back to normal mode.
- The search button state is coherent with the searchbox
- Coherence is kept when changing to a split view or different tab
- Shorcut <Ctrl-F> does not close the searchbar, but moves the focus to it.
Reviewers: #dolphin, ngraham, #vdg, elvisangelaccio
Reviewed By: ngraham, #vdg
Subscribers: ndavis, felixernst, elvisangelaccio, kfm-devel
Tags: #dolphin
Maniphest Tasks: T8473
Differential Revision: https://phabricator.kde.org/D23232
2019-09-01 19:59:43 +00:00
connect ( container , & DolphinViewContainer : : searchModeEnabledChanged ,
this , & DolphinMainWindow : : updateSearchAction ) ;
2021-09-13 15:34:40 +00:00
connect ( container , & DolphinViewContainer : : captionChanged ,
this , & DolphinMainWindow : : updateWindowTitle ) ;
2021-12-17 14:11:46 +00:00
connect ( container , & DolphinViewContainer : : tabRequested ,
this , & DolphinMainWindow : : openNewTab ) ;
connect ( container , & DolphinViewContainer : : activeTabRequested ,
this , & DolphinMainWindow : : openNewTabAndActivate ) ;
[dolphin] Add an action to toggle the searchbar
Summary:
Make search action toggle the searchbar instead of just launching it.
The search action in dolphin did only bring up the search bar, but to close it again you had to go to the closing button on the same searchbar.
This behavior in inconsistent with other dolphin actions which toggle panels or tools.
BEFORE:
{F7256652}
AFTER:
{F7256862}
BUG: 344617
FIXED-IN: 19.12.0
Closes T8473
Depends on D23075
Test Plan:
- Enable the search mode: the searchbar appears and the toolbar button gets checked
- Press the search button again, and it goes back to normal mode.
- The search button state is coherent with the searchbox
- Coherence is kept when changing to a split view or different tab
- Shorcut <Ctrl-F> does not close the searchbar, but moves the focus to it.
Reviewers: #dolphin, ngraham, #vdg, elvisangelaccio
Reviewed By: ngraham, #vdg
Subscribers: ndavis, felixernst, elvisangelaccio, kfm-devel
Tags: #dolphin
Maniphest Tasks: T8473
Differential Revision: https://phabricator.kde.org/D23232
2019-09-01 19:59:43 +00:00
const QAction * toggleSearchAction = actionCollection ( ) - > action ( QStringLiteral ( " toggle_search " ) ) ;
connect ( toggleSearchAction , & QAction : : triggered , container , & DolphinViewContainer : : setSearchModeEnabled ) ;
2011-04-20 18:03:51 +00:00
2022-09-15 13:36:05 +00:00
// Make the toggled state of the selection mode actions visually follow the selection mode state of the view.
auto toggleSelectionModeAction = actionCollection ( ) - > action ( QStringLiteral ( " toggle_selection_mode " ) ) ;
toggleSelectionModeAction - > setChecked ( m_activeViewContainer - > isSelectionModeEnabled ( ) ) ;
connect ( m_activeViewContainer , & DolphinViewContainer : : selectionModeChanged ,
toggleSelectionModeAction , & QAction : : setChecked ) ;
2014-07-02 13:30:37 +00:00
const DolphinView * view = container - > view ( ) ;
2014-04-10 14:53:41 +00:00
connect ( view , & DolphinView : : selectionChanged ,
this , & DolphinMainWindow : : slotSelectionChanged ) ;
connect ( view , & DolphinView : : requestItemInfo ,
2015-01-24 23:42:43 +00:00
this , & DolphinMainWindow : : requestItemInfo ) ;
2021-04-24 09:00:31 +00:00
connect ( view , & DolphinView : : fileItemsChanged ,
this , & DolphinMainWindow : : fileItemsChanged ) ;
2014-09-15 16:17:30 +00:00
connect ( view , & DolphinView : : tabRequested ,
this , & DolphinMainWindow : : openNewTab ) ;
2021-12-17 14:11:46 +00:00
connect ( view , & DolphinView : : activeTabRequested ,
this , & DolphinMainWindow : : openNewTabAndActivate ) ;
connect ( view , & DolphinView : : windowRequested ,
this , & DolphinMainWindow : : openNewWindow ) ;
2014-04-10 14:53:41 +00:00
connect ( view , & DolphinView : : requestContextMenu ,
this , & DolphinMainWindow : : openContextMenu ) ;
connect ( view , & DolphinView : : directoryLoadingStarted ,
this , & DolphinMainWindow : : enableStopAction ) ;
connect ( view , & DolphinView : : directoryLoadingCompleted ,
this , & DolphinMainWindow : : disableStopAction ) ;
2014-11-02 14:34:30 +00:00
connect ( view , & DolphinView : : directoryLoadingCompleted ,
this , & DolphinMainWindow : : slotDirectoryLoadingCompleted ) ;
2014-04-10 14:53:41 +00:00
connect ( view , & DolphinView : : goBackRequested ,
2019-05-05 15:20:44 +00:00
this , & DolphinMainWindow : : goBack ) ;
2014-04-10 14:53:41 +00:00
connect ( view , & DolphinView : : goForwardRequested ,
2019-05-05 15:20:44 +00:00
this , & DolphinMainWindow : : goForward ) ;
2017-04-29 16:47:13 +00:00
connect ( view , & DolphinView : : urlActivated ,
this , & DolphinMainWindow : : handleUrl ) ;
Improve Touch support
With this patch dolphin now supports the following touch gestures:
* Tap gesture to interact/open with directories, files and so on
* TapAndHold and release gesture for access to the context menu (main window, panel folder, places and information)
* TapAndHold and moving gesture for drag and drop action (main windows, panel folder and places)
* pinch gesture for zoom in main window
* kinetic scrolling (QScroller) for main window, panel folder, panel places, panel information, setting preview and service
* two fingers swipe gesture to left, right and up as shortcut to navigate back, forward and up
* two finger tap gesture to toggle item selection, similar to Ctrl and left mouse click
FEATURE: 385066
FIXED-IN: 20.11.80
You are currently rebasing branch 'touch' on '85241a924'.
2020-09-13 18:53:32 +00:00
connect ( view , & DolphinView : : goUpRequested ,
this , & DolphinMainWindow : : goUp ) ;
2007-04-01 18:36:23 +00:00
2021-05-17 12:52:45 +00:00
connect ( container - > urlNavigatorInternalWithHistory ( ) , & KUrlNavigator : : urlChanged ,
this , & DolphinMainWindow : : changeUrl ) ;
connect ( container - > urlNavigatorInternalWithHistory ( ) , & KUrlNavigator : : historyChanged ,
this , & DolphinMainWindow : : updateHistory ) ;
2020-09-20 16:53:59 +00:00
auto navigators = static_cast < DolphinNavigatorsWidgetAction * >
( actionCollection ( ) - > action ( QStringLiteral ( " url_navigators " ) ) ) ;
2020-11-05 22:30:07 +00:00
const KUrlNavigator * navigator = m_tabWidget - > currentTabPage ( ) - > primaryViewActive ( ) ?
navigators - > primaryUrlNavigator ( ) :
navigators - > secondaryUrlNavigator ( ) ;
2020-09-20 16:53:59 +00:00
2020-11-05 22:30:07 +00:00
QAction * editableLocactionAction = actionCollection ( ) - > action ( QStringLiteral ( " editable_location " ) ) ;
2020-09-20 16:53:59 +00:00
editableLocactionAction - > setChecked ( navigator - > isUrlEditable ( ) ) ;
2014-04-10 14:53:41 +00:00
connect ( navigator , & KUrlNavigator : : editableStateChanged ,
this , & DolphinMainWindow : : slotEditableStateChanged ) ;
2014-09-15 16:17:30 +00:00
connect ( navigator , & KUrlNavigator : : tabRequested ,
2020-12-12 13:17:23 +00:00
this , & DolphinMainWindow : : openNewTab ) ;
2021-12-17 14:11:46 +00:00
connect ( navigator , & KUrlNavigator : : activeTabRequested ,
this , & DolphinMainWindow : : openNewTabAndActivate ) ;
connect ( navigator , & KUrlNavigator : : newWindowRequested ,
this , & DolphinMainWindow : : openNewWindow ) ;
2020-06-14 21:08:48 +00:00
2007-04-01 18:36:23 +00:00
}
2007-04-12 17:37:53 +00:00
2007-08-12 17:48:29 +00:00
void DolphinMainWindow : : updateSplitAction ( )
2007-06-03 14:07:45 +00:00
{
2016-03-16 21:17:37 +00:00
QAction * splitAction = actionCollection ( ) - > action ( QStringLiteral ( " split_view " ) ) ;
2014-08-10 16:52:06 +00:00
const DolphinTabPage * tabPage = m_tabWidget - > currentTabPage ( ) ;
2014-07-02 13:30:37 +00:00
if ( tabPage - > splitViewEnabled ( ) ) {
2019-02-16 15:08:12 +00:00
if ( GeneralSettings : : closeActiveSplitView ( ) ? tabPage - > primaryViewActive ( ) : ! tabPage - > primaryViewActive ( ) ) {
2007-08-25 09:54:31 +00:00
splitAction - > setText ( i18nc ( " @action:intoolbar Close left view " , " Close " ) ) ;
2009-11-06 18:02:55 +00:00
splitAction - > setToolTip ( i18nc ( " @info " , " Close left view " ) ) ;
2016-03-16 21:17:37 +00:00
splitAction - > setIcon ( QIcon : : fromTheme ( QStringLiteral ( " view-left-close " ) ) ) ;
2014-07-02 13:30:37 +00:00
} else {
splitAction - > setText ( i18nc ( " @action:intoolbar Close right view " , " Close " ) ) ;
splitAction - > setToolTip ( i18nc ( " @info " , " Close right view " ) ) ;
2016-03-16 21:17:37 +00:00
splitAction - > setIcon ( QIcon : : fromTheme ( QStringLiteral ( " view-right-close " ) ) ) ;
2007-08-12 17:48:29 +00:00
}
2007-06-03 14:07:45 +00:00
} else {
2007-06-30 20:10:50 +00:00
splitAction - > setText ( i18nc ( " @action:intoolbar Split view " , " Split " ) ) ;
2009-11-06 18:02:55 +00:00
splitAction - > setToolTip ( i18nc ( " @info " , " Split view " ) ) ;
2016-03-16 21:17:37 +00:00
splitAction - > setIcon ( QIcon : : fromTheme ( QStringLiteral ( " view-right-new " ) ) ) ;
2007-06-03 14:07:45 +00:00
}
}
2020-11-19 21:22:27 +00:00
void DolphinMainWindow : : updateAllowedToolbarAreas ( )
{
auto navigators = static_cast < DolphinNavigatorsWidgetAction * >
( actionCollection ( ) - > action ( QStringLiteral ( " url_navigators " ) ) ) ;
if ( toolBar ( ) - > actions ( ) . contains ( navigators ) ) {
toolBar ( ) - > setAllowedAreas ( Qt : : TopToolBarArea | Qt : : BottomToolBarArea ) ;
if ( toolBarArea ( toolBar ( ) ) = = Qt : : LeftToolBarArea | |
toolBarArea ( toolBar ( ) ) = = Qt : : RightToolBarArea ) {
addToolBar ( Qt : : TopToolBarArea , toolBar ( ) ) ;
}
} else {
toolBar ( ) - > setAllowedAreas ( Qt : : AllToolBarAreas ) ;
}
}
2008-06-28 18:42:51 +00:00
bool DolphinMainWindow : : isKompareInstalled ( ) const
{
static bool initialized = false ;
static bool installed = false ;
if ( ! initialized ) {
// TODO: maybe replace this approach later by using a menu
// plugin like kdiff3plugin.cpp
2014-10-01 10:34:49 +00:00
installed = ! QStandardPaths : : findExecutable ( QStringLiteral ( " kompare " ) ) . isEmpty ( ) ;
2008-06-28 18:42:51 +00:00
initialized = true ;
}
return installed ;
}
2014-04-10 22:48:52 +00:00
void DolphinMainWindow : : createPanelAction ( const QIcon & icon ,
2011-10-10 20:05:32 +00:00
const QKeySequence & shortcut ,
QAction * dockAction ,
const QString & actionName )
2010-12-19 12:48:24 +00:00
{
2014-04-06 01:32:55 +00:00
QAction * panelAction = actionCollection ( ) - > addAction ( actionName ) ;
2011-11-21 10:04:45 +00:00
panelAction - > setCheckable ( true ) ;
panelAction - > setChecked ( dockAction - > isChecked ( ) ) ;
2011-10-10 20:05:32 +00:00
panelAction - > setText ( dockAction - > text ( ) ) ;
panelAction - > setIcon ( icon ) ;
2022-01-28 19:06:22 +00:00
dockAction - > setIcon ( icon ) ;
2014-09-14 20:49:25 +00:00
actionCollection ( ) - > setDefaultShortcut ( panelAction , shortcut ) ;
2011-10-10 20:05:32 +00:00
2014-04-10 14:53:41 +00:00
connect ( panelAction , & QAction : : triggered , dockAction , & QAction : : trigger ) ;
connect ( dockAction , & QAction : : toggled , panelAction , & QAction : : setChecked ) ;
2010-12-19 12:48:24 +00:00
}
2019-06-23 19:19:49 +00:00
void DolphinMainWindow : : setupWhatsThis ( )
{
// main widgets
menuBar ( ) - > setWhatsThis ( xi18nc ( " @info:whatsthis " , " <para>This is the "
" <emphasis>Menubar</emphasis>. It provides access to commands and "
" configuration options. Left-click on any of the menus on this "
" bar to see its contents.</para><para>The Menubar can be hidden "
" by unchecking <interface>Settings|Show Menubar</interface>. Then "
2022-06-09 21:23:29 +00:00
" most of its contents become available through a <interface>Menu "
2019-06-23 19:19:49 +00:00
" </interface> button on the <emphasis>Toolbar</emphasis>.</para> " ) ) ;
toolBar ( ) - > setWhatsThis ( xi18nc ( " @info:whatsthis " , " <para>This is the "
" <emphasis>Toolbar</emphasis>. It allows quick access to "
" frequently used actions.</para><para>It is highly customizable. "
2022-06-09 21:23:29 +00:00
" All items you see in the <interface>Menu</interface> or "
2019-06-23 19:19:49 +00:00
" in the <interface>Menubar</interface> can be placed on the "
" Toolbar. Just right-click on it and select <interface>Configure "
2022-06-09 21:23:29 +00:00
" Toolbars…</interface> or find this action within the <interface> "
" menu</interface>. "
2019-06-23 19:19:49 +00:00
" </para><para>The location of the bar and the style of its "
" buttons can also be changed in the right-click menu. Right-click "
" a button if you want to show or hide its text.</para> " ) ) ;
m_tabWidget - > setWhatsThis ( xi18nc ( " @info:whatsthis main view " ,
" <para>Here you can see the <emphasis>folders</emphasis> and "
" <emphasis>files</emphasis> that are at the location described in "
" the <interface>Location Bar</interface> above. This area is the "
" central part of this application where you navigate to the files "
" you want to use.</para><para>For an elaborate and general "
" introduction to this application <link "
" url='https://userbase.kde.org/Dolphin/File_Management#Introduction_to_Dolphin'> "
" click here</link>. This will open an introductory article from "
" the <emphasis>KDE UserBase Wiki</emphasis>.</para><para>For brief "
" explanations of all the features of this <emphasis>view</emphasis> "
" <link url='help:/dolphin/dolphin-view.html'>click here</link> "
" instead. This will open a page from the <emphasis>Handbook "
" </emphasis> that covers the basics.</para> " ) ) ;
// Settings menu
actionCollection ( ) - > action ( KStandardAction : : name ( KStandardAction : : KeyBindings ) )
- > setWhatsThis ( xi18nc ( " @info:whatsthis " , " <para>This opens a window "
" that lists the <emphasis>keyboard shortcuts</emphasis>.<nl/> "
" There you can set up key combinations to trigger an action when "
" they are pressed simultaneously. All commands in this application can "
" be triggered this way.</para> " ) ) ;
actionCollection ( ) - > action ( KStandardAction : : name ( KStandardAction : : ConfigureToolbars ) )
- > setWhatsThis ( xi18nc ( " @info:whatsthis " , " <para>This opens a window in which "
" you can change which buttons appear on the <emphasis>Toolbar</emphasis>.</para> "
2022-06-09 21:23:29 +00:00
" <para>All items you see in the <interface>Menu</interface> can also be placed on the Toolbar.</para> " ) ) ;
2019-06-23 19:19:49 +00:00
actionCollection ( ) - > action ( KStandardAction : : name ( KStandardAction : : Preferences ) )
- > setWhatsThis ( xi18nc ( " @info:whatsthis " , " This opens a window where you can "
" change a multitude of settings for this application. For an explanation "
" of the various settings go to the chapter <emphasis>Configuring Dolphin "
" </emphasis> in <interface>Help|Dolphin Handbook</interface>. " ) ) ;
// Help menu
2021-08-10 09:00:21 +00:00
2022-06-09 21:23:29 +00:00
// i18n: If the external link isn't available in your language it might make
// sense to state the external link's language in brackets to not
2019-06-23 19:19:49 +00:00
// frustrate the user. If there are multiple languages that the user might
// know with a reasonable chance you might want to have 2 external links.
2022-06-09 21:23:29 +00:00
// The same might be true for any external link you translate.
actionCollection ( ) - > action ( KStandardAction : : name ( KStandardAction : : HelpContents ) ) - > setWhatsThis ( xi18nc ( " @info:whatsthis handbook " , " <para>This opens the Handbook for this application. It provides explanations for every part of <emphasis>Dolphin</emphasis>.</para><para>If you want more elaborate introductions to the different features of <emphasis>Dolphin</emphasis> <link url='https://userbase.kde.org/Dolphin/File_Management'>click here</link>. It will open the dedicated page in the KDE UserBase Wiki.</para> " ) ) ;
// (The i18n call should be completely in the line following the i18n: comment without any line breaks within the i18n call or the comment might not be correctly extracted. See: https://commits.kde.org/kxmlgui/a31135046e1b3335b5d7bbbe6aa9a883ce3284c1 )
actionCollection ( ) - > action ( KStandardAction : : name ( KStandardAction : : WhatsThis ) ) - > setWhatsThis (
xi18nc ( " @info:whatsthis whatsthis button " ,
2019-06-23 19:19:49 +00:00
" <para>This is the button that invokes the help feature you are "
" using right now! Click it, then click any component of this "
" application to ask \" What's this? \" about it. The mouse cursor "
2022-06-09 21:23:29 +00:00
" will change appearance if no help is available for a spot.</para> "
2019-06-23 19:19:49 +00:00
" <para>There are two other ways to get help: "
" The <link url='help:/dolphin/index.html'>Dolphin Handbook</link> and "
" the <link url='https://userbase.kde.org/Dolphin/File_Management'>KDE "
" UserBase Wiki</link>.</para><para>The \" What's this? \" help is "
" missing in most other windows so don't get too used to this.</para> " ) ) ;
2022-06-09 21:23:29 +00:00
actionCollection ( ) - > action ( KStandardAction : : name ( KStandardAction : : ReportBug ) ) - > setWhatsThis (
xi18nc ( " @info:whatsthis " , " <para>This opens a "
2019-06-23 19:19:49 +00:00
" window that will guide you through reporting errors or flaws "
2022-06-09 21:23:29 +00:00
" in this application or in other KDE software.</para> "
2019-06-23 19:19:49 +00:00
" <para>High-quality bug reports are much appreciated. To learn "
" how to make your bug report as effective as possible "
" <link url='https://community.kde.org/Get_Involved/Bug_Reporting'> "
" click here</link>.</para> " ) ) ;
2022-06-09 21:23:29 +00:00
actionCollection ( ) - > action ( KStandardAction : : name ( KStandardAction : : Donate ) ) - > setWhatsThis (
xi18nc ( " @info:whatsthis " , " <para>This opens a "
2019-06-23 19:19:49 +00:00
" <emphasis>web page</emphasis> where you can donate to "
" support the continued work on this application and many "
" other projects by the <emphasis>KDE</emphasis> community.</para> "
" <para>Donating is the easiest and fastest way to efficiently "
" support KDE and its projects. KDE projects are available for "
" free therefore your donation is needed to cover things that "
" require money like servers, contributor meetings, etc.</para> "
" <para><emphasis>KDE e.V.</emphasis> is the non-profit "
2022-06-09 21:23:29 +00:00
" organization behind the KDE community.</para> " ) ) ;
2019-06-23 19:19:49 +00:00
2022-06-09 21:23:29 +00:00
actionCollection ( ) - > action ( KStandardAction : : name ( KStandardAction : : SwitchApplicationLanguage ) ) - > setWhatsThis (
xi18nc ( " @info:whatsthis " ,
2019-06-23 19:19:49 +00:00
" With this you can change the language this application uses. "
" <nl/>You can even set secondary languages which will be used "
2022-06-09 21:23:29 +00:00
" if texts are not available in your preferred language. " ) ) ;
2019-06-23 19:19:49 +00:00
2022-06-09 21:23:29 +00:00
actionCollection ( ) - > action ( KStandardAction : : name ( KStandardAction : : AboutApp ) ) - > setWhatsThis (
xi18nc ( " @info:whatsthis " , " This opens a "
2019-06-23 19:19:49 +00:00
" window that informs you about the version, license, "
2022-06-09 21:23:29 +00:00
" used libraries and maintainers of this application. " ) ) ;
2019-06-23 19:19:49 +00:00
2022-06-09 21:23:29 +00:00
actionCollection ( ) - > action ( KStandardAction : : name ( KStandardAction : : AboutKDE ) ) - > setWhatsThis (
xi18nc ( " @info:whatsthis " , " This opens a "
2019-06-23 19:19:49 +00:00
" window with information about <emphasis>KDE</emphasis>. "
" The KDE community are the people behind this free software. "
" <nl/>If you like using this application but don't know "
2022-06-09 21:23:29 +00:00
" about KDE or want to see a cute dragon have a look! " ) ) ;
2019-06-23 19:19:49 +00:00
}
2021-04-29 13:22:10 +00:00
bool DolphinMainWindow : : addHamburgerMenuToToolbar ( )
{
QDomDocument domDocument = KXMLGUIClient : : domDocument ( ) ;
if ( domDocument . isNull ( ) ) {
return false ;
}
QDomNode toolbar = domDocument . elementsByTagName ( QStringLiteral ( " ToolBar " ) ) . at ( 0 ) ;
if ( toolbar . isNull ( ) ) {
return false ;
}
QDomElement hamburgerMenuElement = domDocument . createElement ( QStringLiteral ( " Action " ) ) ;
hamburgerMenuElement . setAttribute ( QStringLiteral ( " name " ) , QStringLiteral ( " hamburger_menu " ) ) ;
toolbar . appendChild ( hamburgerMenuElement ) ;
KXMLGUIFactory : : saveConfigFile ( domDocument , xmlFile ( ) ) ;
reloadXML ( ) ;
createGUI ( ) ;
return true ;
// Make sure to also remove the <KXMLGUIFactory> and <QDomDocument> include
// whenever this method is removed (maybe in the year ~2026).
}
2021-04-23 00:06:06 +00:00
// Set a sane initial window size
QSize DolphinMainWindow : : sizeHint ( ) const
{
return KXmlGuiWindow : : sizeHint ( ) . expandedTo ( QSize ( 760 , 550 ) ) ;
}
2020-11-19 21:22:27 +00:00
void DolphinMainWindow : : saveNewToolbarConfig ( )
{
KXmlGuiWindow : : saveNewToolbarConfig ( ) ; // Applies the new config. This has to be called first
// because the rest of this method decides things
// based on the new config.
auto navigators = static_cast < DolphinNavigatorsWidgetAction * >
( actionCollection ( ) - > action ( QStringLiteral ( " url_navigators " ) ) ) ;
if ( ! toolBar ( ) - > actions ( ) . contains ( navigators ) ) {
m_tabWidget - > currentTabPage ( ) - > insertNavigatorsWidget ( navigators ) ;
}
updateAllowedToolbarAreas ( ) ;
2021-04-29 13:22:10 +00:00
( static_cast < KHamburgerMenu * > ( actionCollection ( ) - > action ( KStandardAction : : name (
KStandardAction : : HamburgerMenu ) ) ) ) - > hideActionsOf ( toolBar ( ) ) ;
2020-11-19 21:22:27 +00:00
}
Add action for focusing Terminal Panel
Summary:
Add an action for focusing and de-focusing the Terminal Panel.
FEATURE: 185096
FIXED-IN 20.04.0
Test Plan:
- Hit {key Ctrl Shift F4} or click {nav Tools > Focus Terminal Panel} or {nav Control > Tools > Focus Terminal Panel}
- If the Terminal Panel was closed, it opens and gains focus
- If the Terminal Panel was open but unfocused, it gains focus
- If the Terminal Panel was open and focused, focus returns to the view
{F6630289, size=full}
Reviewers: #dolphin, elvisangelaccio, rominf
Reviewed By: #dolphin, elvisangelaccio, rominf
Subscribers: kfm-devel, elvisangelaccio, rkflx, ngraham, #dolphin
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D10959
2019-03-20 22:06:28 +00:00
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 " ) ) ;
}
}
2008-04-20 22:07:44 +00:00
DolphinMainWindow : : UndoUiInterface : : UndoUiInterface ( ) :
2008-04-30 23:32:33 +00:00
KIO : : FileUndoManager : : UiInterface ( )
2007-04-01 18:36:23 +00:00
{
}
DolphinMainWindow : : UndoUiInterface : : ~ UndoUiInterface ( )
2007-04-12 17:37:53 +00:00
{
}
2007-04-01 18:36:23 +00:00
void DolphinMainWindow : : UndoUiInterface : : jobError ( KIO : : Job * job )
{
2008-04-20 22:07:44 +00:00
DolphinMainWindow * mainWin = qobject_cast < DolphinMainWindow * > ( parentWidget ( ) ) ;
if ( mainWin ) {
2012-04-12 21:57:51 +00:00
DolphinViewContainer * container = mainWin - > activeViewContainer ( ) ;
container - > showMessage ( job - > errorString ( ) , DolphinViewContainer : : Error ) ;
2008-04-20 22:07:44 +00:00
} else {
2008-04-30 23:32:33 +00:00
KIO : : FileUndoManager : : UiInterface : : jobError ( job ) ;
2008-04-20 22:07:44 +00:00
}
2007-04-01 18:36:23 +00:00
}
2022-06-14 18:14:05 +00:00
bool DolphinMainWindow : : isUrlOpen ( const QString & url )
Open externally called files/directories in new tabs
Summary:
FEATURE: 183429
FIXED-IN: 19.08.0
GUI: new cli argument --new-window
Externally called files/directories are opened in a a new tab of an instance of Dolphin that already exists. If any of the given URIs are already open in a tab, then those tabs are activated instead of a new tab being opened. If there is no instance then the files/directories are opened in a new window. The newly opened file/directory has its tab activated, and consequently, the window is also activated.
When the user clicks "Open In New Window" or "Detach Tab", the files/directories are opened in a new window.
Test Plan:
[Manual]
Before testing, set the default file manager in system settings as the newly built Dolphin executable.
One must also include the new dolphin executable in the $PATH, otherwise some functions will attempt to open the system dolphin instead of the new one.
Furthermore, running two different versions of Dolphin (in particular, where one does not have this patch included) can result in bugs appearing, in particular, new tabs not opening as old instances will not recognise the DBus commands sent to it. However, I see no reason why a user will have two different versions of Dolphin (apart from people like us :D).
Open directories with the help of auxillary programs (i.e. a browser). The files/directories should appear in a new window if an instance does not exist. If an existence already exists, then a new tab should be opened and activated in that instance and the window activated.
Use QDBusViewer to open folders/items by calling the ShowFolders/ShowItems methods in org.freedesktop.FileManager1 of the Dolphin instance.
When a user chooses to "Open In New Window"/"Detach Tab" then the files/directories should be opened in a new window.
Reviewers: #dolphin, elvisangelaccio
Subscribers: zzag, dfaure, fvogt, fikrim, magar, fbg13, davidedmundson, kwin, ngraham, elvisangelaccio, anthonyfieroni, kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D16648
2019-05-30 20:22:43 +00:00
{
2022-06-14 18:14:05 +00:00
return m_tabWidget - > isUrlOpen ( QUrl : : fromUserInput ( url ) ) ;
Open externally called files/directories in new tabs
Summary:
FEATURE: 183429
FIXED-IN: 19.08.0
GUI: new cli argument --new-window
Externally called files/directories are opened in a a new tab of an instance of Dolphin that already exists. If any of the given URIs are already open in a tab, then those tabs are activated instead of a new tab being opened. If there is no instance then the files/directories are opened in a new window. The newly opened file/directory has its tab activated, and consequently, the window is also activated.
When the user clicks "Open In New Window" or "Detach Tab", the files/directories are opened in a new window.
Test Plan:
[Manual]
Before testing, set the default file manager in system settings as the newly built Dolphin executable.
One must also include the new dolphin executable in the $PATH, otherwise some functions will attempt to open the system dolphin instead of the new one.
Furthermore, running two different versions of Dolphin (in particular, where one does not have this patch included) can result in bugs appearing, in particular, new tabs not opening as old instances will not recognise the DBus commands sent to it. However, I see no reason why a user will have two different versions of Dolphin (apart from people like us :D).
Open directories with the help of auxillary programs (i.e. a browser). The files/directories should appear in a new window if an instance does not exist. If an existence already exists, then a new tab should be opened and activated in that instance and the window activated.
Use QDBusViewer to open folders/items by calling the ShowFolders/ShowItems methods in org.freedesktop.FileManager1 of the Dolphin instance.
When a user chooses to "Open In New Window"/"Detach Tab" then the files/directories should be opened in a new window.
Reviewers: #dolphin, elvisangelaccio
Subscribers: zzag, dfaure, fvogt, fikrim, magar, fbg13, davidedmundson, kwin, ngraham, elvisangelaccio, anthonyfieroni, kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D16648
2019-05-30 20:22:43 +00:00
}
2022-08-09 14:02:55 +00:00
bool DolphinMainWindow : : isItemVisibleInAnyView ( const QString & urlOfItem )
2022-05-24 13:24:24 +00:00
{
2022-08-09 14:02:55 +00:00
return m_tabWidget - > isItemVisibleInAnyView ( QUrl : : fromUserInput ( urlOfItem ) ) ;
2022-05-24 13:24:24 +00:00
}