diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f3a8bc0257..3eb529b0d9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -150,6 +150,7 @@ set(dolphin_SRCS dolphinmainwindow.cpp dolphinviewcontainer.cpp dolphincontextmenu.cpp + dolphinrecenttabsmenu.cpp filterbar/filterbar.cpp main.cpp panels/information/filemetadataconfigurationdialog.cpp @@ -328,6 +329,7 @@ install( FILES settings/dolphin_directoryviewpropertysettings.kcfg settings/dolphin_versioncontrolsettings.kcfg DESTINATION ${KCFG_INSTALL_DIR} ) install( FILES dolphinui.rc DESTINATION ${DATA_INSTALL_DIR}/dolphin ) +install( FILES dolphin.appdata.xml DESTINATION ${SHARE_INSTALL_PREFIX}/appdata ) install( FILES search/filenamesearch.protocol DESTINATION ${SERVICES_INSTALL_DIR} ) install( FILES settings/kcm/kcmdolphinviewmodes.desktop DESTINATION ${SERVICES_INSTALL_DIR} ) diff --git a/src/dolphin.appdata.xml b/src/dolphin.appdata.xml new file mode 100644 index 0000000000..042da79506 --- /dev/null +++ b/src/dolphin.appdata.xml @@ -0,0 +1,158 @@ + + + dolphin.desktop + CC0-1.0 + GPL-2.0+ + Dolphin + Dolphin + Dolphin + Dolphin + Dolphin + Dolphin + Dolphin + Dolphin + Dolphin + Dolphin + Dolphin + Dolphin + xxDolphinxx + File Manager + Gestor de fitxers + Dateiverwaltung + Dateipleger + Bestandsbeheerder + Zarządzanie plikami + Gestor de Ficheiros + Gerenciador de arquivos + Správca súborov + Filhanterare + Програма для керування файлами + xxFile Managerxx + +

Dolphin is a lightweight file manager. It has been designed with ease of use and simplicity in mind, while still allowing flexibility and customisation. This means that you can do your file management exactly the way you want to do it.

+

El Dolphin és un gestor de fitxers lleuger. S'ha dissenyat pensant en facilitar el seu ús i que sigui simple, permetent la flexibilitat i la personalització. Això vol dir que podeu fer la gestió dels vostres fitxers de la manera exacta com ho vulgueu fer.

+

Dolphin is en slank Dateipleger. Dat wöör buut mit de Idee vun't eenfache Bedenen vör Ogen, bides dat liekers flexibel un topassbor wesen schull. Du kannst Dien Dateien also jüst so plegen, as Du dat wullt.

+

Dolphin is een lichtgewicht bestandsbeheerder. Het is ontworpen met gebruiksgemak en eenvoud in gedachte en staat toch flexibiliteit en aan te passen toe. Dit betekent dat u uw bestandsbeheer kunt doen precies op de manier zoals u dat wilt.

+

Dolphin jest lekkim programem do zarządzania plikami. Został on opracowany mając na uwadze łatwość i prostotę obsługi, zapewniając jednocześnie elastyczność i możliwość dostosowania. Oznacza to, że można urządzić zarządzanie plikami w dokładnie taki sposób w jaki jest to pożądane.

+

O Dolphin é um gestor de ficheiros leve. Foi desenhado com a facilidade de uso e simplicidade em mente, permitindo à mesma a flexibilidade e personalização. Isto significa que poderá fazer a sua gestão de ficheiros exactamente da forma que deseja.

+

Dolphin é um gerenciador de arquivos leve e fácil de usar. Foi projetado para ser simples e ao mesmo tempo manter a flexibilidade e personalização. Isso significa que você poderá gerenciar seus arquivos da forma que desejar.

+

Dolphin je odľahčený správca súborov. Bol navrhnutý na jednoduché použitie a jednoduchosť, ale s možnosťami flexibility a prispôsobenia. To znamená, že môžete vykonávať správu súborov presne tak, ako chcete.

+

Dolphin är en lättviktig filhanterare. Den har konstruerats med användbarhet och enkelhet i åtanke, men ändå tillåta flexibilitet och anpassning. Det betyder att du kan hantera filer exakt på det sätt som du vill göra det.

+

Dolphin — невибаглива до ресурсів програма для керування файлами. Її створено простою у користуванні і гнучкою у налаштовуванні. Це означає, що ви можете зробити керування файлами саме таким, як вам потрібно.

+

xxDolphin is a lightweight file manager. It has been designed with ease of use and simplicity in mind, while still allowing flexibility and customisation. This means that you can do your file management exactly the way you want to do it.xx

+

Features:

+

Característiques:

+

Funktionen:

+

Markmalen:

+

Mogelijkheden:

+

Możliwości:

+

Características:

+

Funcionalidades:

+

Funkcie:

+

Funktioner:

+

Можливості:

+

xxFeatures:xx

+ +
+ http://dolphin.kde.org/ + https://bugs.kde.org/enter_bug.cgi?format=guided&product=dolphin + http://docs.kde.org/stable/en/applications/dolphin/index.html + + + http://kde.org/images/screenshots/dolphin.png + + + KDE + + dolphin + +
diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 52cc83a096..75cc12f460 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -25,6 +25,7 @@ #include "dolphindockwidget.h" #include "dolphincontextmenu.h" #include "dolphinnewfilemenu.h" +#include "dolphinrecenttabsmenu.h" #include "dolphinviewcontainer.h" #include "panels/folders/folderspanel.h" #include "panels/places/placespanel.h" @@ -96,19 +97,6 @@ namespace { const int CurrentDolphinVersion = 200; }; -/* - * Remembers the tab configuration if a tab has been closed. - * Each closed tab can be restored by the menu - * "Go -> Recently Closed Tabs". - */ -struct ClosedTab -{ - KUrl primaryUrl; - KUrl secondaryUrl; - bool isSplit; -}; -Q_DECLARE_METATYPE(ClosedTab) - DolphinMainWindow::DolphinMainWindow() : KXmlGuiWindow(0), m_newFileMenu(0), @@ -743,35 +731,6 @@ void DolphinMainWindow::slotUndoAvailable(bool available) } } -void DolphinMainWindow::restoreClosedTab(QAction* action) -{ - if (action->data().toBool()) { - // clear all actions except the "Empty Recently Closed Tabs" - // action and the separator - QList actions = m_recentTabsMenu->menu()->actions(); - const int count = actions.size(); - for (int i = 2; i < count; ++i) { - m_recentTabsMenu->menu()->removeAction(actions.at(i)); - } - } else { - const ClosedTab closedTab = action->data().value(); - openNewTab(closedTab.primaryUrl); - m_tabBar->setCurrentIndex(m_viewTab.count() - 1); - - if (closedTab.isSplit) { - // create secondary view - toggleSplitView(); - m_viewTab[m_tabIndex].secondaryView->setUrl(closedTab.secondaryUrl); - } - - m_recentTabsMenu->removeAction(action); - } - - if (m_recentTabsMenu->menu()->actions().count() == 2) { - m_recentTabsMenu->setEnabled(false); - } -} - void DolphinMainWindow::slotUndoTextChanged(const QString& text) { QAction* undoAction = actionCollection()->action(KStandardAction::name(KStandardAction::Undo)); @@ -1140,7 +1099,10 @@ void DolphinMainWindow::closeTab(int index) // previous tab before closing the tab. m_tabBar->setCurrentIndex((index > 0) ? index - 1 : 1); } - rememberClosedTab(index); + + const KUrl primaryUrl(m_viewTab[index].primaryView->url()); + const KUrl secondaryUrl(m_viewTab[index].secondaryView ? m_viewTab[index].secondaryView->url() : KUrl()); + emit rememberClosedTab(primaryUrl, secondaryUrl); // delete tab m_viewTab[index].primaryView->deleteLater(); @@ -1439,6 +1401,18 @@ void DolphinMainWindow::slotPlaceActivated(const KUrl& url) } } +void DolphinMainWindow::restoreClosedTab(const KUrl& primaryUrl, const KUrl& secondaryUrl) +{ + openNewActivatedTab(primaryUrl); + + if (!secondaryUrl.isEmpty() && secondaryUrl.isValid()) { + const int index = m_tabBar->currentIndex(); + createSecondaryView(index); + setActiveViewContainer(m_viewTab[index].secondaryView); + m_viewTab[index].secondaryView->setUrl(secondaryUrl); + } +} + void DolphinMainWindow::setActiveViewContainer(DolphinViewContainer* viewContainer) { Q_ASSERT(viewContainer); @@ -1586,19 +1560,12 @@ void DolphinMainWindow::setupActions() backShortcuts.append(QKeySequence(Qt::Key_Backspace)); backAction->setShortcuts(backShortcuts); - m_recentTabsMenu = new KActionMenu(i18n("Recently Closed Tabs"), this); - m_recentTabsMenu->setIcon(QIcon::fromTheme("edit-undo")); - m_recentTabsMenu->setDelayed(false); - actionCollection()->addAction("closed_tabs", m_recentTabsMenu); - connect(m_recentTabsMenu->menu(), &QMenu::triggered, - this, &DolphinMainWindow::restoreClosedTab); - - QAction* action = new QAction(i18n("Empty Recently Closed Tabs"), m_recentTabsMenu); - action->setIcon(QIcon::fromTheme("edit-clear-list")); - action->setData(QVariant::fromValue(true)); - m_recentTabsMenu->addAction(action); - m_recentTabsMenu->addSeparator(); - m_recentTabsMenu->setEnabled(false); + DolphinRecentTabsMenu* recentTabsMenu = new DolphinRecentTabsMenu(this); + actionCollection()->addAction("closed_tabs", recentTabsMenu); + connect(this, SIGNAL(rememberClosedTab(KUrl,KUrl)), + recentTabsMenu, SLOT(rememberClosedTab(KUrl,KUrl))); + connect(recentTabsMenu, SIGNAL(restoreClosedTab(KUrl,KUrl)), + this, SLOT(restoreClosedTab(KUrl,KUrl))); KStandardAction::forward(this, SLOT(goForward()), actionCollection()); KStandardAction::up(this, SLOT(goUp()), actionCollection()); @@ -1902,44 +1869,6 @@ bool DolphinMainWindow::addActionToMenu(QAction* action, KMenu* menu) return true; } -void DolphinMainWindow::rememberClosedTab(int index) -{ - QMenu* tabsMenu = m_recentTabsMenu->menu(); - - const QString primaryPath = m_viewTab[index].primaryView->url().path(); - const QString iconName = KIO::iconNameForUrl(primaryPath); - - QAction* action = new QAction(squeezedText(primaryPath), tabsMenu); - - ClosedTab closedTab; - closedTab.primaryUrl = m_viewTab[index].primaryView->url(); - - if (m_viewTab[index].secondaryView) { - closedTab.secondaryUrl = m_viewTab[index].secondaryView->url(); - closedTab.isSplit = true; - } else { - closedTab.isSplit = false; - } - - action->setData(QVariant::fromValue(closedTab)); - action->setIcon(QIcon::fromTheme(iconName)); - - // add the closed tab menu entry after the separator and - // "Empty Recently Closed Tabs" entry - if (tabsMenu->actions().size() == 2) { - tabsMenu->addAction(action); - } else { - tabsMenu->insertAction(tabsMenu->actions().at(2), action); - } - - // assure that only up to 8 closed tabs are shown in the menu - if (tabsMenu->actions().size() > 8) { - tabsMenu->removeAction(tabsMenu->actions().last()); - } - actionCollection()->action("closed_tabs")->setEnabled(true); - KAcceleratorManager::manage(tabsMenu); -} - void DolphinMainWindow::refreshViews() { Q_ASSERT(m_viewTab[m_tabIndex].primaryView); diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h index 1192f6e460..4fe13d29fd 100644 --- a/src/dolphinmainwindow.h +++ b/src/dolphinmainwindow.h @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include @@ -156,6 +156,11 @@ signals: */ void settingsChanged(); + /** + * Is emitted when a tab has been closed. + */ + void rememberClosedTab(const KUrl& primaryUrl, const KUrl& secondaryUrl); + protected: /** @see QWidget::showEvent() */ virtual void showEvent(QShowEvent* event); @@ -192,9 +197,6 @@ private slots: */ void slotUndoAvailable(bool available); - /** Invoked when an action in the recent tabs menu is clicked. */ - void restoreClosedTab(QAction* action); - /** Sets the text of the 'Undo' menu action to \a text. */ void slotUndoTextChanged(const QString& text); @@ -473,6 +475,12 @@ private slots: */ void slotPlaceActivated(const KUrl& url); + /** + * Is called when the user wants to reopen a previously closed \a tab from + * the recent tabs menu. + */ + void restoreClosedTab(const KUrl& primaryUrl, const KUrl& secondaryUrl); + private: /** * Activates the given view, which means that @@ -503,11 +511,6 @@ private: */ bool addActionToMenu(QAction* action, KMenu* menu); - /** - * Adds the tab[\a index] to the closed tab menu's list of actions. - */ - void rememberClosedTab(int index); - /** * Connects the signals from the created DolphinView with * the DolphinViewContainer \a container with the corresponding slots of @@ -572,7 +575,6 @@ private: }; KNewFileMenu* m_newFileMenu; - KActionMenu* m_recentTabsMenu; KTabBar* m_tabBar; DolphinViewContainer* m_activeViewContainer; QVBoxLayout* m_centralWidgetLayout; diff --git a/src/dolphinrecenttabsmenu.cpp b/src/dolphinrecenttabsmenu.cpp new file mode 100644 index 0000000000..d0b694c03c --- /dev/null +++ b/src/dolphinrecenttabsmenu.cpp @@ -0,0 +1,96 @@ +/*************************************************************************** + * Copyright (C) 2014 by Emmanuel Pescosta * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#include "dolphinrecenttabsmenu.h" + +#include +#include +#include +#include + +DolphinRecentTabsMenu::DolphinRecentTabsMenu(QObject* parent) : + KActionMenu(QIcon::fromTheme("edit-undo"), i18n("Recently Closed Tabs"), parent) +{ + setDelayed(false); + setEnabled(false); + + m_clearListAction = new QAction(i18n("Empty Recently Closed Tabs"), this); + m_clearListAction->setIcon(QIcon::fromTheme("edit-clear-list")); + addAction(m_clearListAction); + + addSeparator(); + + connect(menu(), SIGNAL(triggered(QAction*)), + this, SLOT(handleAction(QAction*))); +} + +void DolphinRecentTabsMenu::rememberClosedTab(const KUrl& primaryUrl, const KUrl& secondaryUrl) +{ + QAction* action = new QAction(menu()); + action->setText(primaryUrl.path()); + + const QString iconName = KMimeType::iconNameForUrl(primaryUrl); + action->setIcon(QIcon::fromTheme(iconName)); + + KUrl::List urls; + urls << primaryUrl; + urls << secondaryUrl; + action->setData(QVariant::fromValue(urls)); + + // Add the closed tab menu entry after the separator and + // "Empty Recently Closed Tabs" entry + if (menu()->actions().size() == 2) { + addAction(action); + } else { + insertAction(menu()->actions().at(2), action); + } + + // Assure that only up to 6 closed tabs are shown in the menu. + // 8 because of clear action + separator + 6 closed tabs + if (menu()->actions().size() > 8) { + removeAction(menu()->actions().last()); + } + setEnabled(true); + KAcceleratorManager::manage(menu()); +} + +void DolphinRecentTabsMenu::handleAction(QAction* action) +{ + if (action == m_clearListAction) { + // Clear all actions except the "Empty Recently Closed Tabs" + // action and the separator + QList actions = menu()->actions(); + const int count = actions.size(); + for (int i = 2; i < count; ++i) { + removeAction(actions.at(i)); + } + } else { + const KUrl::List urls = action->data().value(); + if (urls.count() == 2) { + emit restoreClosedTab(urls.first(), urls.last()); + } + removeAction(action); + delete action; + action = 0; + } + + if (menu()->actions().count() <= 2) { + setEnabled(false); + } +} \ No newline at end of file diff --git a/src/dolphinrecenttabsmenu.h b/src/dolphinrecenttabsmenu.h new file mode 100644 index 0000000000..34d41530b6 --- /dev/null +++ b/src/dolphinrecenttabsmenu.h @@ -0,0 +1,49 @@ +/*************************************************************************** + * Copyright (C) 2014 by Emmanuel Pescosta * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the * + * Free Software Foundation, Inc., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * + ***************************************************************************/ + +#ifndef DOLPHIN_RECENT_TABS_MENU_H +#define DOLPHIN_RECENT_TABS_MENU_H + +#include +#include + +class DolphinTabPage; +class QAction; + +class DolphinRecentTabsMenu : public KActionMenu +{ + Q_OBJECT + +public: + explicit DolphinRecentTabsMenu(QObject* parent); + +public slots: + void rememberClosedTab(const KUrl& primaryUrl, const KUrl& secondaryUrl); + +signals: + void restoreClosedTab(const KUrl& primaryUrl, const KUrl& secondaryUrl); + +private slots: + void handleAction(QAction* action); + +private: + QAction* m_clearListAction; +}; + +#endif \ No newline at end of file diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp index 13057cbbd6..4d5879f4da 100644 --- a/src/kitemviews/kfileitemmodel.cpp +++ b/src/kitemviews/kfileitemmodel.cpp @@ -451,6 +451,8 @@ void KFileItemModel::setRoles(const QSet& roles) if (m_roles == roles) { return; } + + const QSet changedRoles = (roles - m_roles) + (m_roles - roles); m_roles = roles; if (count() > 0) { @@ -479,8 +481,7 @@ void KFileItemModel::setRoles(const QSet& roles) m_itemData[i]->values = retrieveData(m_itemData.at(i)->item, m_itemData.at(i)->parent); } - kWarning() << "TODO: Emitting itemsChanged() with no information what has changed!"; - emit itemsChanged(KItemRangeList() << KItemRange(0, count()), QSet()); + emit itemsChanged(KItemRangeList() << KItemRange(0, count()), changedRoles); } // Clear the 'values' of all filtered items. They will be re-populated with the