CMakeLists.txt.user
.directory
*.kdev4
+/build*/
# KDE Application Version, managed by release script
set (KDE_APPLICATIONS_VERSION_MAJOR "19")
-set (KDE_APPLICATIONS_VERSION_MINOR "08")
-set (KDE_APPLICATIONS_VERSION_MICRO "0")
+set (KDE_APPLICATIONS_VERSION_MINOR "11")
+set (KDE_APPLICATIONS_VERSION_MICRO "70")
set (KDE_APPLICATIONS_VERSION "${KDE_APPLICATIONS_VERSION_MAJOR}.${KDE_APPLICATIONS_VERSION_MINOR}.${KDE_APPLICATIONS_VERSION_MICRO}")
project(Dolphin VERSION ${KDE_APPLICATIONS_VERSION})
set(QT_MIN_VERSION "5.8.0")
-set(KF5_MIN_VERSION "5.57.0")
+set(KF5_MIN_VERSION "5.61.0")
# ECM setup
find_package(ECM ${KF5_MIN_VERSION} CONFIG REQUIRED)
void DolphinMainWindow::slotTerminalPanelVisibilityChanged()
{
- if (m_terminalPanel->isHiddenInVisibleWindow()) {
+ if (m_terminalPanel->isHiddenInVisibleWindow() && m_activeViewContainer) {
m_activeViewContainer->view()->setFocus();
}
}
QAction* newWindow = KStandardAction::openNew(this, &DolphinMainWindow::openNewMainWindow, actionCollection());
newWindow->setText(i18nc("@action:inmenu File", "New &Window"));
+ newWindow->setToolTip(i18nc("@info", "Open a new Dolphin window"));
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."));
m_controlButton = new QToolButton(this);
m_controlButton->setIcon(QIcon::fromTheme(QStringLiteral("application-menu")));
- m_controlButton->setText(i18nc("@action", "Control"));
+ m_controlButton->setToolTip(i18nc("@action", "Show menu"));
m_controlButton->setAttribute(Qt::WidgetAttribute::WA_CustomWhatsThis);
m_controlButton->setPopupMode(QToolButton::InstantPopup);
- m_controlButton->setToolButtonStyle(toolBar()->toolButtonStyle());
QMenu* controlMenu = new QMenu(m_controlButton);
connect(controlMenu, &QMenu::aboutToShow, this, &DolphinMainWindow::updateControlMenu);
toolBar()->addWidget(m_controlButton);
connect(toolBar(), &KToolBar::iconSizeChanged,
m_controlButton, &QToolButton::setIconSize);
- connect(toolBar(), &KToolBar::toolButtonStyleChanged,
- m_controlButton, &QToolButton::setToolButtonStyle);
// The added widgets are owned by the toolbar and may get deleted when e.g. the toolbar
// gets edited. In this case we must add them again. The adding is done asynchronously by
QWidget* focusWidget = QApplication::focusWidget();
DolphinTabPage* tabPage = new DolphinTabPage(primaryUrl, secondaryUrl, this);
+ tabPage->setActive(false);
tabPage->setPlacesSelectorVisible(m_placesSelectorVisible);
connect(tabPage, &DolphinTabPage::activeViewChanged,
this, &DolphinTabWidget::activeViewChanged);
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
-<kpartgui name="dolphin" version="22">
+<kpartgui name="dolphin" version="23">
<MenuBar>
<Menu name="file">
<Action name="new_menu" />
<Action name="compact" />
<Action name="details" />
<Separator name="separator_0" />
- <Action name="edit_find"/>
- <Action name="show_preview" />
+ <Action name="sort" />
+ <Spacer name="spacer_0" />
<Action name="split_view" />
<Action name="split_stash" />
+ <Action name="edit_find" />
</ToolBar>
<ActionProperties scheme="Default">
<Action priority="0" name="go_back"/>
<Action priority="0" name="edit_cut"/>
<Action priority="0" name="edit_copy"/>
<Action priority="0" name="edit_paste"/>
+ <Action priority="0" name="edit_find"/>
</ActionProperties>
</kpartgui>
return false;
}
- const QStringList services = QDBusConnection::sessionBus().interface()->registeredServiceNames().value();
-
- // Don't match the service without trailing "-" (unique instance)
- const QString pattern = QStringLiteral("org.kde.dolphin-");
- // Don't match the pid without leading "-"
- const QString myPid = QStringLiteral("-") + QString::number(QCoreApplication::applicationPid());
QVector<QPair<QSharedPointer<QDBusInterface>, QStringList>> dolphinServices;
if (!preferredService.isEmpty()) {
QSharedPointer<QDBusInterface> preferred(
QStringLiteral("org.kde.dolphin.MainWindow"))
);
if (preferred->isValid() && !preferred->lastError().isValid()) {
- dolphinServices.append(qMakePair(preferred, QStringList() ));
+ dolphinServices.append(qMakePair(preferred, QStringList()));
}
}
// find all dolphin instances
+ const QStringList services = QDBusConnection::sessionBus().interface()->registeredServiceNames().value();
+ // Don't match the service without trailing "-" (unique instance)
+ const QString pattern = QStringLiteral("org.kde.dolphin-");
+ // Don't match the pid without leading "-"
+ const QString myPid = QStringLiteral("-") + QString::number(QCoreApplication::applicationPid());
for (const QString& service : services) {
if (service.startsWith(pattern) && !service.endsWith(myPid)) {
// Check if instance can handle our URLs
QStringLiteral("/dolphin/Dolphin_1"),
QStringLiteral("org.kde.dolphin.MainWindow"))
);
- if (!instance->isValid() || instance->lastError().isValid()) {
- continue;
+ if (instance->isValid() && !instance->lastError().isValid()) {
+ dolphinServices.append(qMakePair(instance, QStringList()));
}
- dolphinServices.append(qMakePair(instance, QStringList()));
}
}
for (auto& service: dolphinServices) {
QDBusReply<bool> isUrlOpen = service.first->call(QStringLiteral("isUrlOpen"), url);
if (isUrlOpen.isValid() && isUrlOpen.value()) {
- service.second.append(url);
- urlFound = true;
- break;
+ service.second.append(url);
+ urlFound = true;
+ break;
}
}
if (!urlFound) {
if (firstChar != newFirstChar) {
QString newGroupValue;
if (newFirstChar.isLetter()) {
- // Try to find a matching group in the range 'A' to 'Z'.
- static std::vector<QChar> lettersAtoZ;
- lettersAtoZ.reserve('Z' - 'A' + 1);
- if (lettersAtoZ.empty()) {
- for (char c = 'A'; c <= 'Z'; ++c) {
- lettersAtoZ.push_back(QLatin1Char(c));
+
+ if (m_collator.compare(newFirstChar, QChar(QLatin1Char('A'))) >= 0 && m_collator.compare(newFirstChar, QChar(QLatin1Char('Z'))) <= 0) {
+ // WARNING! Symbols based on latin 'Z' like 'Z' with acute are treated wrong as non Latin and put in a new group.
+
+ // Try to find a matching group in the range 'A' to 'Z'.
+ static std::vector<QChar> lettersAtoZ;
+ lettersAtoZ.reserve('Z' - 'A' + 1);
+ if (lettersAtoZ.empty()) {
+ for (char c = 'A'; c <= 'Z'; ++c) {
+ lettersAtoZ.push_back(QLatin1Char(c));
+ }
}
- }
- auto localeAwareLessThan = [this](QChar c1, QChar c2) -> bool {
- return m_collator.compare(c1, c2) < 0;
- };
+ auto localeAwareLessThan = [this](QChar c1, QChar c2) -> bool {
+ return m_collator.compare(c1, c2) < 0;
+ };
- std::vector<QChar>::iterator it = std::lower_bound(lettersAtoZ.begin(), lettersAtoZ.end(), newFirstChar, localeAwareLessThan);
- if (it != lettersAtoZ.end()) {
- if (localeAwareLessThan(newFirstChar, *it) && it != lettersAtoZ.begin()) {
- // newFirstChar belongs to the group preceding *it.
- // Example: for an umlaut 'A' in the German locale, *it would be 'B' now.
- --it;
+ std::vector<QChar>::iterator it = std::lower_bound(lettersAtoZ.begin(), lettersAtoZ.end(), newFirstChar, localeAwareLessThan);
+ if (it != lettersAtoZ.end()) {
+ if (localeAwareLessThan(newFirstChar, *it)) {
+ // newFirstChar belongs to the group preceding *it.
+ // Example: for an umlaut 'A' in the German locale, *it would be 'B' now.
+ --it;
+ }
+ newGroupValue = *it;
}
- newGroupValue = *it;
+
} else {
+ // Symbols from non Latin-based scripts
newGroupValue = newFirstChar;
}
} else if (newFirstChar >= QLatin1Char('0') && newFirstChar <= QLatin1Char('9')) {
do {
QString lastTextLine = nameText.mid(line.textStart());
lastTextLine = m_customizedFontMetrics.elidedText(lastTextLine,
- Qt::ElideRight,
+ Qt::ElideMiddle,
elidingWidth);
const QString elidedText = nameText.left(line.textStart()) + lastTextLine;
nameTextInfo->staticText.setText(elidedText);
textLine.setLineWidth(maxWidth);
requiredWidth = textLine.naturalTextWidth();
if (requiredWidth > maxWidth) {
- const QString elidedText = m_customizedFontMetrics.elidedText(text, Qt::ElideRight, maxWidth);
+ const QString elidedText = m_customizedFontMetrics.elidedText(text, Qt::ElideMiddle, maxWidth);
textInfo->staticText.setText(elidedText);
requiredWidth = m_customizedFontMetrics.width(elidedText);
} else if (role == "rating") {
qreal requiredWidth = m_customizedFontMetrics.width(text);
if (requiredWidth > maxWidth) {
requiredWidth = maxWidth;
- const QString elidedText = m_customizedFontMetrics.elidedText(text, Qt::ElideRight, maxWidth);
+ const QString elidedText = m_customizedFontMetrics.elidedText(text, Qt::ElideMiddle, maxWidth);
textInfo->staticText.setText(elidedText);
}
}
if (requiredWidth > availableTextWidth) {
- text = m_customizedFontMetrics.elidedText(text, Qt::ElideRight, availableTextWidth);
+ text = m_customizedFontMetrics.elidedText(text, Qt::ElideMiddle, availableTextWidth);
requiredWidth = m_customizedFontMetrics.width(text);
}
bool TerminalPanel::isHiddenInVisibleWindow() const
{
return parentWidget()
- && parentWidget()->isHidden()
- && m_terminal
- && !hasProgramRunning();
+ && parentWidget()->isHidden();
}
void TerminalPanel::dockVisibilityChanged()
{
// Only react when the DockWidget itself (not some parent) is hidden. This way we don't
// respond when e.g. Dolphin is minimized.
- if (isHiddenInVisibleWindow()) {
+ if (isHiddenInVisibleWindow() && m_terminal && !hasProgramRunning()) {
// Make sure that the following "cd /" command will not affect the view.
disconnect(m_konsolePart, SIGNAL(currentDirectoryChanged(QString)),
this, SLOT(slotKonsolePartCurrentDirectoryChanged(QString)));
// View properties
m_globalViewProps = new QRadioButton(i18nc("@option:radio", "Use common properties for all folders"));
m_localViewProps = new QRadioButton(i18nc("@option:radio", "Remember properties for each folder"));
- m_localViewProps->setToolTip(i18nc("@info", "Dolphin will create an hidden .directory file in each folder you change view properties for."));
+ m_localViewProps->setToolTip(i18nc("@info", "Dolphin will create a hidden .directory file in each folder you change view properties for."));
QButtonGroup* viewGroup = new QButtonGroup(this);
viewGroup->addButton(m_globalViewProps);
#include <QDir>
#include <QDirIterator>
#include <QCommandLineParser>
+#include <QMimeDatabase>
#include <KLocalizedString>
exit(1);
}
-bool evaluateShell(const QString &program, const QStringList &arguments, QString &output, QString &errorText)
-{
- QProcess process;
- process.start(program, arguments, QIODevice::ReadOnly);
- if (!process.waitForStarted()) {
- fail(i18n("Failed to run process: %1 %2", program, arguments.join(" ")));
- }
-
- if (!process.waitForFinished()) {
- fail(i18n("Process did not finish in reasonable time: %1 %2", program, arguments.join(" ")));
- }
-
- const auto stdoutResult = QString::fromUtf8(process.readAllStandardOutput()).trimmed();
- const auto stderrResult = QString::fromUtf8(process.readAllStandardError()).trimmed();
-
- if (process.exitStatus() == QProcess::NormalExit && process.exitCode() == 0) {
- output = stdoutResult;
- return true;
- } else {
- errorText = stderrResult + stdoutResult;
- return false;
- }
-}
-
-QString mimeType(const QString &path)
-{
- QString result;
- QString errorText;
- if (evaluateShell("xdg-mime", QStringList{"query", "filetype", path}, result, errorText)) {
- return result;
- } else {
- fail(i18n("Failed to run xdg-mime %1: %2", path, errorText));
- }
-}
-
QString getServiceMenusDir()
{
const QString dataLocation = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation);
"multipart/x-zip"},
UncompressCommand{"unzip", QStringList{}, QStringList{"-d"}}});
- const auto mime = mimeType(inputPath);
+ const auto mime = QMimeDatabase().mimeTypeForFile(inputPath).name();
UncompressCommand command{};
for (const auto &pair : mimeTypeToCommand) {
m_container = new KItemListContainer(controller, this);
m_container->installEventFilter(this);
setFocusProxy(m_container);
- connect(m_container->horizontalScrollBar(), &QScrollBar::valueChanged, this, &DolphinView::hideToolTip);
- connect(m_container->verticalScrollBar(), &QScrollBar::valueChanged, this, &DolphinView::hideToolTip);
+ connect(m_container->horizontalScrollBar(), &QScrollBar::valueChanged, this, [=] { hideToolTip(); });
+ connect(m_container->verticalScrollBar(), &QScrollBar::valueChanged, this, [=] { hideToolTip(); });
controller->setSelectionBehavior(KItemListController::MultiSelection);
connect(controller, &KItemListController::itemActivated, this, &DolphinView::slotItemActivated);
break;
case QEvent::KeyPress:
+ hideToolTip(ToolTipManager::HideBehavior::Instantly);
if (GeneralSettings::useTabForSwitchingSplitView()) {
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
if (keyEvent->key() == Qt::Key_Tab && keyEvent->modifiers() == Qt::NoModifier) {
}
}
-void DolphinView::hideToolTip()
+void DolphinView::hideToolTip(const ToolTipManager::HideBehavior behavior)
{
#ifdef HAVE_BALOO
if (GeneralSettings::showToolTips()) {
- m_toolTipManager->hideToolTip();
+ m_toolTipManager->hideToolTip(behavior);
}
#endif
}
#include "dolphintabwidget.h"
#include "dolphin_export.h"
+#include "tooltips/tooltipmanager.h"
#include <KFileItem>
#include <KIO/Job>
*/
void updateViewState();
- void hideToolTip();
-
/**
* Calculates the number of currently shown files into
* \a fileCount and the number of folders into \a folderCount.
*/
void applyModeToView();
+ /**
+ * Hides tooltip displayed over element.
+ */
+ void hideToolTip(const ToolTipManager::HideBehavior behavior = ToolTipManager::HideBehavior::Later);
+
/**
* Helper method for DolphinView::paste() and DolphinView::pasteIntoFolder().
* Pastes the clipboard data into the URL \a url.
"</interface> option is enabled.</para>"));
compactAction->setWhatsThis(xi18nc("@info:whatsthis Compact view mode",
"<para>This switches to a compact view mode that lists the folders "
- "and files in columns with the names beside the icons. <para></para>"
+ "and files in columns with the names beside the icons.</para><para>"
"This helps to keep the overview in folders with many items.</para>"));
detailsAction->setWhatsThis(xi18nc("@info:whatsthis Details view mode",
"<para>This switches to a list view mode that focuses on folder "
QAction* zoomOutAction = KStandardAction::zoomOut(this,
&DolphinViewActionHandler::zoomOut,
m_actionCollection);
- zoomOutAction->setWhatsThis(i18nc("@info:whatsthis zoom in", "This reduces the icon size."));
+ zoomOutAction->setWhatsThis(i18nc("@info:whatsthis zoom out", "This reduces the icon size."));
KToggleAction* showPreview = m_actionCollection->add<KToggleAction>(QStringLiteral("show_preview"));
showPreview->setText(i18nc("@action:intoolbar", "Preview"));
QActionGroup* DolphinViewActionHandler::createFileItemRolesActionGroup(const QString& groupPrefix)
{
const bool isSortGroup = (groupPrefix == QLatin1String("sort_by_"));
- Q_ASSERT(isSortGroup || (!isSortGroup && groupPrefix == QLatin1String("show_")));
+ Q_ASSERT(isSortGroup || groupPrefix == QLatin1String("show_"));
QActionGroup* rolesActionGroup = new QActionGroup(m_actionCollection);
rolesActionGroup->setExclusive(isSortGroup);
Q_ASSERT(!m_metaDataRequested);
}
-void ToolTipManager::hideToolTip()
+void ToolTipManager::hideToolTip(const HideBehavior behavior)
{
if (m_appliedWaitCursor) {
QApplication::restoreOverrideCursor();
m_showToolTipTimer->stop();
m_contentRetrievalTimer->stop();
if (m_tooltipWidget) {
- m_tooltipWidget->hideLater();
+ switch (behavior) {
+ case HideBehavior::Instantly:
+ m_tooltipWidget->hide();
+ break;
+ case HideBehavior::Later:
+ m_tooltipWidget->hideLater();
+ break;
+ }
}
}
Q_OBJECT
public:
+ enum class HideBehavior {
+ Instantly,
+ Later
+ };
+
explicit ToolTipManager(QWidget* parent);
~ToolTipManager() override;
/**
* Hides the currently shown tooltip.
*/
- void hideToolTip();
+ void hideToolTip(const HideBehavior behavior = HideBehavior::Later);
signals:
/**