2015-04-22 13:29:39 +00:00
|
|
|
/*
|
2020-08-25 17:07:38 +00:00
|
|
|
* SPDX-FileCopyrightText: 2015 Ashish Bansal <bansal.ashish096@gmail.com>
|
2015-04-22 13:29:39 +00:00
|
|
|
*
|
2020-08-25 17:07:38 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2015-04-22 13:29:39 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GLOBAL_H
|
|
|
|
#define GLOBAL_H
|
|
|
|
|
|
|
|
#include <QList>
|
|
|
|
#include <QUrl>
|
2019-12-09 22:21:51 +00:00
|
|
|
#include <QWidget>
|
2015-04-22 13:29:39 +00:00
|
|
|
|
2021-01-02 17:48:52 +00:00
|
|
|
class KConfigGroup;
|
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
|
|
|
class OrgKdeDolphinMainWindowInterface;
|
|
|
|
|
2023-02-03 17:14:53 +00:00
|
|
|
namespace Dolphin
|
|
|
|
{
|
|
|
|
QList<QUrl> validateUris(const QStringList &uriList);
|
2015-10-10 13:09:48 +00:00
|
|
|
|
2023-02-03 17:14:53 +00:00
|
|
|
/**
|
|
|
|
* Returns the home url which is defined in General Settings
|
|
|
|
*/
|
|
|
|
QUrl homeUrl();
|
2017-03-08 15:52:15 +00:00
|
|
|
|
2023-02-03 17:14:53 +00:00
|
|
|
enum class OpenNewWindowFlag { None = 0, Select = 1 << 1 };
|
|
|
|
Q_DECLARE_FLAGS(OpenNewWindowFlags, OpenNewWindowFlag)
|
2017-03-08 15:52:15 +00:00
|
|
|
|
2023-02-03 17:14:53 +00:00
|
|
|
/**
|
|
|
|
* Opens a new Dolphin window
|
|
|
|
*/
|
|
|
|
void openNewWindow(const QList<QUrl> &urls = {}, QWidget *window = nullptr, const OpenNewWindowFlags &flags = OpenNewWindowFlag::None);
|
Modernize Settings window
Summary: This patch modernizes the appearance of Dolphin's configuration window by following the KDE HIG as much as possible and following design cues from Plasma and System Settings.
Test Plan:
Tested all settings to make sure they still work; they do.
Startup page, before:
{F5825313}
Startup page, after:
{F5918574}
View page (Icons), before:
{F5825319}
View page (Icons) after:
{F5918575}
View page (Compact), before:
{F5825321}
View page (Compact) after:
{F5918700}
View page (Detailed), before:
{F5825323}
View page: (Detailed), after:
{F5918701}
Navigation page: no change
Trash page, before:
{F5858748}
Trash page, after:
{F5866656}
(Provided by {D12986})
General page (behavior), before:
{F5825316}
General page (behavior) after:
{F5918572}
General page (confirmations), before:
{F5866885}
General page (confirmations), after:
{F5918702}
General page (status bar): no change
Reviewers: #dolphin, #vdg, broulik, elvisangelaccio
Reviewed By: #dolphin, elvisangelaccio
Subscribers: fabianr, cfeck, medhefgo, zzag, rkflx, kfm-devel, elvisangelaccio, abetts
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D12571
2018-07-06 03:24:27 +00:00
|
|
|
|
2023-02-03 17:14:53 +00:00
|
|
|
/**
|
|
|
|
* Attaches URLs to an existing Dolphin instance if possible.
|
|
|
|
* If @p preferredService is a valid dbus service, it will be tried first.
|
|
|
|
* @p preferredService needs to support the org.kde.dolphin.MainWindow dbus interface with the /dolphin/Dolphin_1 path.
|
|
|
|
* Returns true if the URLs were successfully attached.
|
|
|
|
*/
|
|
|
|
bool attachToExistingInstance(const QList<QUrl> &inputUrls, bool openFiles, bool splitView, const QString &preferredService, 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
|
|
|
|
2023-02-03 17:14:53 +00:00
|
|
|
/**
|
|
|
|
* Returns a QVector with all GUI-capable Dolphin instances
|
|
|
|
*/
|
|
|
|
QVector<QPair<QSharedPointer<OrgKdeDolphinMainWindowInterface>, QStringList>> dolphinGuiInstances(const QString &preferredService);
|
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
|
|
|
|
2023-02-03 17:14:53 +00:00
|
|
|
QPair<QString, Qt::SortOrder> sortOrderForUrl(QUrl &url);
|
2021-06-04 12:04:14 +00:00
|
|
|
|
2023-02-03 17:14:53 +00:00
|
|
|
/**
|
|
|
|
* TODO: Move this somewhere global to all KDE apps, not just Dolphin
|
|
|
|
*/
|
|
|
|
const int VERTICAL_SPACER_HEIGHT = 12;
|
|
|
|
const int LAYOUT_SPACING_SMALL = 2;
|
2015-04-22 13:29:39 +00:00
|
|
|
}
|
|
|
|
|
2023-02-03 17:14:53 +00:00
|
|
|
enum Animated { WithAnimation, WithoutAnimation };
|
2021-09-12 13:33:39 +00:00
|
|
|
|
2021-01-02 17:48:52 +00:00
|
|
|
class GlobalConfig : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
GlobalConfig() = delete;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return a value from the global KDE config that should be
|
|
|
|
* multiplied with every animation duration once.
|
|
|
|
* 0.0 is returned if animations are globally turned off.
|
|
|
|
* 1.0 is the default value.
|
|
|
|
*/
|
|
|
|
static double animationDurationFactor();
|
|
|
|
|
|
|
|
private:
|
|
|
|
static void updateAnimationDurationFactor(const KConfigGroup &group, const QByteArrayList &names);
|
|
|
|
|
|
|
|
private:
|
|
|
|
static double s_animationDurationFactor;
|
|
|
|
};
|
|
|
|
|
2015-04-22 13:29:39 +00:00
|
|
|
#endif //GLOBAL_H
|