┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFelix Ernst <[email protected]>2024-09-15 18:52:49 +0200
committerFelix Ernst <[email protected]>2024-10-17 15:52:31 +0000
commitb9c04a701d093fe56c516f520fa16c8f6eb1e007 (patch)
tree27d5a3ed3703b189893cb6bf5c98f3ae7209a8eb /src
parent819960aed450d9aa40fd42dc42ad7119c88a4802 (diff)
Add phone UI
Previous to this commit launching Dolphin on phones (e.g. those running Plasma Mobile) would show Dolphin with its default user interface optimised for desktop usage. This commit changes this so instead a phone form factor optimised user interface is used. The differences to the default UI configuration are: -Toolbar at bottom -Icon-only toolbar -Different actions on the toolbar -Places panel hidden -Location bar at the top with a button to show places -Zoom slider hidden (pinch gestures to zoom still work) Through these changes Dolphin actually has a good user experience on phones by default. All the features were already there. Especially Steffen Hartleib's work to trigger selection mode on long press leads to great UX when dealing with multiple files. Still, this might be considered just a start towards making Dolphin great on phone form factors. Secondary windows that Dolphin might spawn are not yet adapted, but are usable on Plasma Mobile as they are anyway.
Diffstat (limited to 'src')
-rw-r--r--src/dolphin.qrc1
-rw-r--r--src/dolphinmainwindow.cpp10
-rw-r--r--src/dolphinuiforphones.rc136
3 files changed, 146 insertions, 1 deletions
diff --git a/src/dolphin.qrc b/src/dolphin.qrc
index 55cae54b9..bd32ef734 100644
--- a/src/dolphin.qrc
+++ b/src/dolphin.qrc
@@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/kxmlgui5/dolphin">
<file>dolphinui.rc</file>
+<file>dolphinuiforphones.rc</file>
</qresource>
</RCC>
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp
index 7d62f52ed..36f0316c6 100644
--- a/src/dolphinmainwindow.cpp
+++ b/src/dolphinmainwindow.cpp
@@ -54,6 +54,7 @@
#include <KProtocolInfo>
#include <KProtocolManager>
#include <KRecentFilesAction>
+#include <KRuntimePlatform>
#include <KShell>
#include <KShortcutsDialog>
#include <KStandardAction>
@@ -190,7 +191,8 @@ DolphinMainWindow::DolphinMainWindow()
setupDockWidgets();
- setupGUI(Save | Create | ToolBar);
+ const bool usePhoneUi{KRuntimePlatform::runtimePlatform().contains(QLatin1String("phone"))};
+ setupGUI(Save | Create | ToolBar, usePhoneUi ? QStringLiteral("dolphinuiforphones.rc") : QString() /* load the default dolphinui.rc file */);
stateChanged(QStringLiteral("new_file"));
QClipboard *clipboard = QApplication::clipboard();
@@ -201,6 +203,12 @@ DolphinMainWindow::DolphinMainWindow()
if (firstRun) {
menuBar()->setVisible(false);
+
+ if (usePhoneUi) {
+ Q_ASSERT(qobject_cast<QDockWidget *>(m_placesPanel->parent()));
+ m_placesPanel->parentWidget()->hide();
+ GeneralSettings::setShowZoomSlider(false);
+ }
}
const bool showMenu = !menuBar()->isHidden();
diff --git a/src/dolphinuiforphones.rc b/src/dolphinuiforphones.rc
new file mode 100644
index 000000000..ba5945cc3
--- /dev/null
+++ b/src/dolphinuiforphones.rc
@@ -0,0 +1,136 @@
+<?xml version="1.0"?>
+<!DOCTYPE gui SYSTEM "kpartgui.dtd">
+<gui name="dolphin" version="1">
+ <MenuBar>
+ <Menu name="file">
+ <Action name="new_menu" />
+ <Action name="file_new" />
+ <Action name="new_tab" />
+ <Action name="file_close" />
+ <Action name="undo_close_tab" />
+ <Separator/>
+ <Action name="add_to_places" />
+ <Separator/>
+ <Action name="renamefile" />
+ <Action name="duplicate" />
+ <Action name="movetotrash" />
+ <Action name="deletefile" />
+ <Separator/>
+ <Action name="show_target" />
+ <Separator/>
+ <Action name="properties" />
+ </Menu>
+ <Menu name="edit">
+ <Action name="edit_undo" />
+ <Separator />
+ <Action name="edit_cut" />
+ <Action name="edit_copy" />
+ <Action name="copy_location" />
+ <Action name="edit_paste" />
+ <Separator />
+ <Action name="show_filter_bar" />
+ <Action name="edit_find" />
+ <Separator />
+ <Action name="toggle_selection_mode" />
+ <Action name="copy_to_inactive_split_view" />
+ <Action name="move_to_inactive_split_view" />
+ <Action name="edit_select_all" />
+ <Action name="invert_selection" />
+ </Menu>
+ <Menu name="view">
+ <Action name="view_zoom_in"/>
+ <Action name="view_zoom_reset"/>
+ <Action name="view_zoom_out"/>
+ <Separator/>
+ <Action name="sort" />
+ <Action name="view_mode" />
+ <Action name="additional_info" />
+ <Action name="show_preview" />
+ <Action name="show_in_groups" />
+ <Action name="show_hidden_files" />
+ <Action name="act_as_admin" />
+ <Separator/>
+ <Action name="split_view_menu" />
+ <Action name="popout_split_view" />
+ <Action name="split_stash" />
+ <Action name="redisplay" />
+ <Action name="stop" />
+ <Separator/>
+ <Action name="panels" />
+ <Menu name="location_bar" icon="edit-select-text">
+ <text context="@title:menu">Location Bar</text>
+ <Action name="editable_location" />
+ <Action name="replace_location" />
+ </Menu>
+ <Separator/>
+ <Action name="view_properties" />
+ </Menu>
+ <Menu name="go">
+ <Action name="bookmarks" />
+ <Action name="closed_tabs" />
+ </Menu>
+ <Menu name="tools">
+ <Action name="open_preferred_search_tool" />
+ <Action name="open_terminal" />
+ <Action name="open_terminal_here" />
+ <Action name="compare_files" />
+ <Action name="change_remote_encoding" />
+ </Menu>
+ </MenuBar>
+ <State name="new_file" >
+ <disable>
+ <Action name="edit_undo" />
+ <Action name="edit_redo" />
+ <Action name="edit_cut" />
+ <Action name="renamefile" />
+ <Action name="movetotrash" />
+ <Action name="deletefile" />
+ <Action name="invert_selection" />
+ <Separator/>
+ <Action name="go_back" />
+ <Action name="go_forward" />
+ </disable>
+ </State>
+ <State name="has_selection" >
+ <enable>
+ <Action name="invert_selection" />
+ </enable>
+ </State>
+ <State name="has_no_selection" >
+ <disable>
+ <Action name="delete_shortcut" />
+ <Action name="invert_selection" />
+ </disable>
+ </State>
+ <ToolBar noMerge="1" position="Bottom" ToolButtonStyle="icononly" name="mainToolBar" >
+ <text context="@title:menu">Main Toolbar</text>
+ <Action name="go_back" />
+ <Action name="go_forward" />
+ <Spacer name="spacer_1" />
+ <Action name="new_menu" />
+ <Action name="edit_copy" />
+ <Action name="renamefile" />
+ <Action name="movetotrash" />
+ <Spacer name="spacer_2" />
+ <Action name="toggle_search" />
+ <Action name="hamburger_menu" />
+ </ToolBar>
+ <ActionProperties scheme="Default">
+ <Action priority="0" name="go_back"/>
+ <Action priority="0" name="go_forward"/>
+ <Action priority="0" name="go_up"/>
+ <Action priority="0" name="go_home"/>
+ <Action priority="0" name="stop"/>
+ <Action priority="0" name="icons"/>
+ <Action priority="0" name="compact"/>
+ <Action priority="0" name="details"/>
+ <Action priority="0" name="view_zoom_in"/>
+ <Action priority="0" name="view_zoom_reset"/>
+ <Action priority="0" name="view_zoom_out"/>
+ <Action priority="0" name="edit_cut"/>
+ <Action priority="0" name="edit_copy"/>
+ <Action priority="0" name="edit_paste"/>
+ <Action priority="0" name="toggle_search"/>
+ <Action priority="0" name="toggle_filter"/>
+ </ActionProperties>
+</gui>