Merge remote-tracking branch 'origin/master' into frameworks

Conflicts:
	dolphin/src/dolphinmainwindow.cpp
	dolphin/src/dolphinmainwindow.h
This commit is contained in:
Frank Reininghaus 2014-06-29 20:26:17 +02:00
commit 81b84a1eaf
7 changed files with 343 additions and 106 deletions

View file

@ -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} )

158
src/dolphin.appdata.xml Normal file
View file

@ -0,0 +1,158 @@
<?xml version="1.0" encoding="utf-8"?>
<component type="desktop">
<id>dolphin.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-2.0+</project_license>
<name>Dolphin</name>
<name xml:lang="ca">Dolphin</name>
<name xml:lang="da">Dolphin</name>
<name xml:lang="de">Dolphin</name>
<name xml:lang="nds">Dolphin</name>
<name xml:lang="nl">Dolphin</name>
<name xml:lang="pl">Dolphin</name>
<name xml:lang="pt">Dolphin</name>
<name xml:lang="pt-BR">Dolphin</name>
<name xml:lang="sk">Dolphin</name>
<name xml:lang="sv">Dolphin</name>
<name xml:lang="uk">Dolphin</name>
<name xml:lang="x-test">xxDolphinxx</name>
<summary>File Manager</summary>
<summary xml:lang="ca">Gestor de fitxers</summary>
<summary xml:lang="de">Dateiverwaltung</summary>
<summary xml:lang="nds">Dateipleger</summary>
<summary xml:lang="nl">Bestandsbeheerder</summary>
<summary xml:lang="pl">Zarządzanie plikami</summary>
<summary xml:lang="pt">Gestor de Ficheiros</summary>
<summary xml:lang="pt-BR">Gerenciador de arquivos</summary>
<summary xml:lang="sk">Správca súborov</summary>
<summary xml:lang="sv">Filhanterare</summary>
<summary xml:lang="uk">Програма для керування файлами</summary>
<summary xml:lang="x-test">xxFile Managerxx</summary>
<description>
<p>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.</p>
<p xml:lang="ca">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.</p>
<p xml:lang="nds">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.</p>
<p xml:lang="nl">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.</p>
<p xml:lang="pl">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.</p>
<p xml:lang="pt">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.</p>
<p xml:lang="pt-BR">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.</p>
<p xml:lang="sk">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.</p>
<p xml:lang="sv">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.</p>
<p xml:lang="uk">Dolphin — невибаглива до ресурсів програма для керування файлами. Її створено простою у користуванні і гнучкою у налаштовуванні. Це означає, що ви можете зробити керування файлами саме таким, як вам потрібно.</p>
<p xml:lang="x-test">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</p>
<p>Features:</p>
<p xml:lang="ca">Característiques:</p>
<p xml:lang="de">Funktionen:</p>
<p xml:lang="nds">Markmalen:</p>
<p xml:lang="nl">Mogelijkheden:</p>
<p xml:lang="pl">Możliwości:</p>
<p xml:lang="pt">Características:</p>
<p xml:lang="pt-BR">Funcionalidades:</p>
<p xml:lang="sk">Funkcie:</p>
<p xml:lang="sv">Funktioner:</p>
<p xml:lang="uk">Можливості:</p>
<p xml:lang="x-test">xxFeatures:xx</p>
<ul>
<li>Navigation (or breadcrumb) bar for URLs, allowing you to quickly navigate through the hierarchy of files and folders.</li>
<li xml:lang="ca">Barra de navegació (o fil d'Ariadna) per els URL, permetent una navegació ràpida per la jerarquia de fitxers i carpetes.</li>
<li xml:lang="nds">Steed- (oder Krömelspoor-)Balken för URLs, mit de Du Di fix dör de Hierarchie ut Dateien un Ornern bewegen kannst</li>
<li xml:lang="nl">Navigatie- (of broodkruimel)balk voor URL's, waarmee u snel kunt navigeren door de hiërarchie van bestanden en mappen.</li>
<li xml:lang="pl">Pasek nawigacji (lub okruchy chleba) dla adresów URL, umożliwiające szybkie przechodzenie w hierarchii plików i katalogów.</li>
<li xml:lang="pt">Barra de navegação dos URL's, que lhe permite navegar rapidamente pela hierarquia de ficheiros e pastas.</li>
<li xml:lang="pt-BR">Barra de navegação de URLs, permitindo-lhe navegar rapidamente pela hierarquia de arquivos e pastas.</li>
<li xml:lang="sk">Navigačná lišta pre URL, umožňujúca vám rýchlu navigáciu cez hierarchiu súborov a priečinkov.</li>
<li xml:lang="sv">Navigeringsrad (eller länkstig) för webbadresser, som låter dig snabbt navigera igenom hierarkin av filer och kataloger.</li>
<li xml:lang="uk">Панель навігації (звичайний режим і режим послідовної навігації) для адрес надає вам змогу швидко пересуватися ієрархією файлів та каталогів.</li>
<li xml:lang="x-test">xxNavigation (or breadcrumb) bar for URLs, allowing you to quickly navigate through the hierarchy of files and folders.xx</li>
<li>Supports several different kinds of view styles and properties and allows you to configure the view exactly how you want it.</li>
<li xml:lang="ca">Accepta diferents classes diverses d'estils de visualització i propietats i us permet configurar la visualització exactament com la vulgueu.</li>
<li xml:lang="nds">Ünnerstütt en Reeg verscheden Ansichtstilen un -egenschappen un lett Di de Ansicht jüst so topassen, as Du dat bruukst.</li>
<li xml:lang="nl">Ondersteunt een aantal verschillende soorten stijlen van weergave en eigenschappen en biedt u de mogelijkheid de weergave in te stellen precies zoals u dat wilt.</li>
<li xml:lang="pl">Obsługa wielu różnych rodzajów stylów widoków i właściwości oraz możliwość ustawienia widoku dopasowanego do potrzeb.</li>
<li xml:lang="pt">Suposta diferentes tipos de vistas e propriedades e permite-lhe configurar cada vista exactamente como a deseja.</li>
<li xml:lang="pt-BR">Suporte a diferentes tipos de visualização, permitindo-lhe configurar cada modo de exibição da forma que desejar.</li>
<li xml:lang="sk">Podporuje niekoľko rôznych typov štýlov zobrazenia a vlastností a umožňuje vám nastaviť pohľad presne tak, ako chcete.</li>
<li xml:lang="sv">Stöder flera olika sorters visningsstilar och egenskaper och låter dig anpassa visningen exakt som du vill ha den.</li>
<li xml:lang="uk">Підтримка декількох різних типів та параметрів перегляду надає вам змогу налаштувати перегляд каталогів саме так, як вам це потрібно.</li>
<li xml:lang="x-test">xxSupports several different kinds of view styles and properties and allows you to configure the view exactly how you want it.xx</li>
<li>Split view, allowing you to easily copy or move files between locations.</li>
<li xml:lang="ca">Divisió de visualització, permetent copiar o moure fitxers fàcilment entre les ubicacions.</li>
<li xml:lang="nds">Deelt Ansicht, mit De Du Dateien eenfach twischen Steden koperen oder bewegen kannst.</li>
<li xml:lang="nl">Gesplitst beeld, waarmee u gemakkelijk bestanden kunt kopiëren of verplaatsen tussen locaties.</li>
<li xml:lang="pl">Widok podzielony, umożliwiający łatwe kopiowane lub przenoszenie plików pomiędzy położeniami.</li>
<li xml:lang="pt">Uma vista dividida, que lhe permite facilmente copiar ou mover os ficheiros entre locais.</li>
<li xml:lang="pt-BR">Um modo de exibição dividido, permitindo-lhe copiar ou mover arquivos facilmente entre locais.</li>
<li xml:lang="sk">Rozdelený pohľad, umožňuje vám jednoducho kopírovať alebo presúvať súbory medzi umiestneniami.</li>
<li xml:lang="sv">Delad visning, som låter dig enkelt kopiera eller flytta filer mellan platser.</li>
<li xml:lang="uk">За допомогою режиму двопанельного розділеного перегляду ви зможе без проблем копіювати або пересувати файли між каталогами.</li>
<li xml:lang="x-test">xxSplit view, allowing you to easily copy or move files between locations.xx</li>
<li>Additional information and shortcuts are available as dock-able panels, allowing you to move them around freely and display exactly what you want.</li>
<li xml:lang="ca">Hi ha informació addicional i dreceres disponibles com a plafons acoblables, permetent moure'ls lliurement i mostrar exactament el què vulgueu.</li>
<li xml:lang="nds">Bito-Infos un Leestekens laat sik as Paneels andocken, Du kannst ehr verschuven un se jüst dat wiesen laten, wat Du weten wullt.</li>
<li xml:lang="nl">Extra informatie en sneltoetsen zijn beschikbaar als vast te zetten panelen, die u vrij kunt verplaatsen en precies kunt tonen wat u wilt.</li>
<li xml:lang="pl">Dodatkowe szczegóły i skróty dostępne jako dokowalne panele, umożliwiające ich dowolne przenoszenie i wyświetlanie dopasowane do potrzeb.</li>
<li xml:lang="pt">Estão disponíveis informações e atalhos adicionais como painéis acopláveis, permitindo-lhe movê-los à vontade e apresentar como desejar.</li>
<li xml:lang="pt-BR">As informações e atalhos adicionais estão disponíveis na forma de painéis acopláveis, permitindo-lhe movê-los à vontade e apresentar como desejar.</li>
<li xml:lang="sk">Dodatočné informácie a skratky sú dostupné ako dokovateľné panely, umožňujúce vám ich voľný presun a zobrazenie presne tak, ako chcete.</li>
<li xml:lang="sv">Ytterligare information och genvägar är tillgängliga som dockningsbara paneler, vilket låter dig flytta omkring dem fritt och visa exakt vad du vill.</li>
<li xml:lang="uk">За допомогою бічних пересувних панелей ви зможете отримувати додаткову інформацію та пересуватися каталогами. Ви можете розташувати ці панелі так, як вам це зручно, і наказати програмі показувати на них саме те, що вам потрібно.</li>
<li xml:lang="x-test">xxAdditional information and shortcuts are available as dock-able panels, allowing you to move them around freely and display exactly what you want.xx</li>
<li>Multiple tab support</li>
<li xml:lang="ca">Implementació de pestanyes múltiples</li>
<li xml:lang="nds">Ünnerstütten för Paneels</li>
<li xml:lang="nl">Ondersteuning voor meerdere tabbladen</li>
<li xml:lang="pl">Obsługa wielu kart</li>
<li xml:lang="pt">Suporte para várias páginas</li>
<li xml:lang="pt-BR">Suporte a várias abas</li>
<li xml:lang="sk">Podpora viacerých kariet</li>
<li xml:lang="sv">Stöd för flera flikar</li>
<li xml:lang="uk">Підтримка роботи з вкладками.</li>
<li xml:lang="x-test">xxMultiple tab supportxx</li>
<li>Informational dialogues are displayed in an unobtrusive way.</li>
<li xml:lang="ca">El diàlegs informatius es mostren de manera no molesta.</li>
<li xml:lang="nds">Informatschoondialogen kaamt Di nich in'n Weg.</li>
<li xml:lang="nl">Informatiedialogen worden op een prettige manier getoond.</li>
<li xml:lang="pl">Pokazywanie informacyjnych okien dialogowych w nienatrętny sposób.</li>
<li xml:lang="pt">As janelas informativas são apresentadas de forma não-intrusiva.</li>
<li xml:lang="pt-BR">As janelas informativas são apresentadas de forma não-intrusiva.</li>
<li xml:lang="sk">Informačné dialógy sú zobrazené nevtieravým spôsobom.</li>
<li xml:lang="sv">Dialogrutor med information visas på ett diskret sätt.</li>
<li xml:lang="uk">Показ інформаційних панелей у зручний спосіб, що не заважає роботі.</li>
<li xml:lang="x-test">xxInformational dialogues are displayed in an unobtrusive way.xx</li>
<li>Undo/redo support</li>
<li xml:lang="ca">Implementació de desfer/refer</li>
<li xml:lang="nds">Ünnerstütten för Torüchnehmen un Wedderherstellen</li>
<li xml:lang="nl">Ondersteuning ongedaan maken/opnieuw</li>
<li xml:lang="pl">Obsługa cofnij/ponów</li>
<li xml:lang="pt">Suporte para desfazer/refazer</li>
<li xml:lang="pt-BR">Suporte para desfazer/refazer</li>
<li xml:lang="sk">Podpora Späť/Znova</li>
<li xml:lang="sv">Stöd för ångra och gör om</li>
<li xml:lang="uk">Підтримка скасовування та повторення дій.</li>
<li xml:lang="x-test">xxUndo/redo supportxx</li>
<li>Transparent network access through the KIO system.</li>
<li xml:lang="ca">Accés transparent a la xarxa a través del sistema KIO.</li>
<li xml:lang="nds">Direkt Nettwarktogriep över dat KDE-In-/Utgaav-(KIO-)Moduulsysteem</li>
<li xml:lang="nl">Transparante toegang tot het netwerk via het KIO systeem.</li>
<li xml:lang="pl">Przezroczysty dostęp do sieci przez system KIO.</li>
<li xml:lang="pt">Acesso transparente à rede através do sistema KIO.</li>
<li xml:lang="pt-BR">Acesso transparente à rede através do sistema KIO.</li>
<li xml:lang="sk">Transparentný prístup na sieť cez KIO systém.</li>
<li xml:lang="sv">Transparent nätverksåtkomst via I/O-slavsystemet.</li>
<li xml:lang="uk">Прозорий доступ до ресурсів у мережі за допомогою системи KIO.</li>
<li xml:lang="x-test">xxTransparent network access through the KIO system.xx</li>
</ul>
</description>
<url type="homepage">http://dolphin.kde.org/</url>
<url type="bugtracker">https://bugs.kde.org/enter_bug.cgi?format=guided&amp;product=dolphin</url>
<url type="help">http://docs.kde.org/stable/en/applications/dolphin/index.html</url>
<screenshots>
<screenshot type="default">
<image>http://kde.org/images/screenshots/dolphin.png</image>
</screenshot>
</screenshots>
<project_group>KDE</project_group>
<provides>
<binary>dolphin</binary>
</provides>
</component>

View file

@ -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<QAction*> 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<ClosedTab>();
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);

View file

@ -28,7 +28,7 @@
#include <kio/fileundomanager.h>
#include <ksortablelist.h>
#include <kxmlguiwindow.h>
#include <KActionMenu>
#include <KIcon>
#include <QList>
#include <QWeakPointer>
@ -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;

View file

@ -0,0 +1,96 @@
/***************************************************************************
* Copyright (C) 2014 by Emmanuel Pescosta <emmanuelpescosta099@gmail.com> *
* *
* 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 <KLocalizedString>
#include <KAcceleratorManager>
#include <KMimeType>
#include <KMenu>
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<QAction*> 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<KUrl::List>();
if (urls.count() == 2) {
emit restoreClosedTab(urls.first(), urls.last());
}
removeAction(action);
delete action;
action = 0;
}
if (menu()->actions().count() <= 2) {
setEnabled(false);
}
}

View file

@ -0,0 +1,49 @@
/***************************************************************************
* Copyright (C) 2014 by Emmanuel Pescosta <emmanuelpescosta099@gmail.com> *
* *
* 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 <KActionMenu>
#include <KUrl>
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

View file

@ -451,6 +451,8 @@ void KFileItemModel::setRoles(const QSet<QByteArray>& roles)
if (m_roles == roles) {
return;
}
const QSet<QByteArray> changedRoles = (roles - m_roles) + (m_roles - roles);
m_roles = roles;
if (count() > 0) {
@ -479,8 +481,7 @@ void KFileItemModel::setRoles(const QSet<QByteArray>& 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<QByteArray>());
emit itemsChanged(KItemRangeList() << KItemRange(0, count()), changedRoles);
}
// Clear the 'values' of all filtered items. They will be re-populated with the