mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-19 00:11:21 +00:00
keep in sync with 4.0 branch (767566)
svn path=/trunk/KDE/kdebase/apps/; revision=767567
This commit is contained in:
parent
f824a33461
commit
a6f5c499ef
|
@ -191,16 +191,14 @@ void DolphinMainWindow::slotShowPreviewChanged()
|
|||
|
||||
void DolphinMainWindow::slotShowHiddenFilesChanged()
|
||||
{
|
||||
KToggleAction* showHiddenFilesAction =
|
||||
static_cast<KToggleAction*>(actionCollection()->action("show_hidden_files"));
|
||||
QAction* showHiddenFilesAction = actionCollection()->action("show_hidden_files");
|
||||
const DolphinView* view = m_activeViewContainer->view();
|
||||
showHiddenFilesAction->setChecked(view->showHiddenFiles());
|
||||
}
|
||||
|
||||
void DolphinMainWindow::slotCategorizedSortingChanged()
|
||||
{
|
||||
KToggleAction* showInGroupsAction =
|
||||
static_cast<KToggleAction*>(actionCollection()->action("show_in_groups"));
|
||||
QAction* showInGroupsAction = actionCollection()->action("show_in_groups");
|
||||
const DolphinView* view = m_activeViewContainer->view();
|
||||
showInGroupsAction->setChecked(view->categorizedSorting());
|
||||
showInGroupsAction->setEnabled(view->supportsCategorizedSorting());
|
||||
|
@ -244,14 +242,13 @@ void DolphinMainWindow::slotSortingChanged(DolphinView::Sorting sorting)
|
|||
}
|
||||
|
||||
if (action != 0) {
|
||||
KToggleAction* toggleAction = static_cast<KToggleAction*>(action);
|
||||
toggleAction->setChecked(true);
|
||||
action->setChecked(true);
|
||||
}
|
||||
}
|
||||
|
||||
void DolphinMainWindow::slotSortOrderChanged(Qt::SortOrder order)
|
||||
{
|
||||
KToggleAction* descending = static_cast<KToggleAction*>(actionCollection()->action("descending"));
|
||||
QAction* descending = actionCollection()->action("descending");
|
||||
const bool sortDescending = (order == Qt::DescendingOrder);
|
||||
descending->setChecked(sortDescending);
|
||||
}
|
||||
|
@ -297,8 +294,7 @@ void DolphinMainWindow::slotHistoryChanged()
|
|||
|
||||
void DolphinMainWindow::updateFilterBarAction(bool show)
|
||||
{
|
||||
KToggleAction* showFilterBarAction =
|
||||
static_cast<KToggleAction*>(actionCollection()->action("show_filter_bar"));
|
||||
QAction* showFilterBarAction = actionCollection()->action("show_filter_bar");
|
||||
showFilterBarAction->setChecked(show);
|
||||
}
|
||||
|
||||
|
@ -605,11 +601,10 @@ void DolphinMainWindow::toggleSortOrder()
|
|||
m_activeViewContainer->view()->toggleSortOrder();
|
||||
}
|
||||
|
||||
void DolphinMainWindow::toggleSortCategorization()
|
||||
void DolphinMainWindow::toggleSortCategorization(bool categorizedSorting)
|
||||
{
|
||||
DolphinView* view = m_activeViewContainer->view();
|
||||
const bool categorizedSorting = view->categorizedSorting();
|
||||
view->setCategorizedSorting(!categorizedSorting);
|
||||
view->setCategorizedSorting(categorizedSorting);
|
||||
}
|
||||
|
||||
void DolphinMainWindow::toggleSplitView()
|
||||
|
@ -657,31 +652,20 @@ void DolphinMainWindow::stopLoading()
|
|||
{
|
||||
}
|
||||
|
||||
void DolphinMainWindow::togglePreview()
|
||||
void DolphinMainWindow::togglePreview(bool show)
|
||||
{
|
||||
clearStatusBar();
|
||||
|
||||
const KToggleAction* showPreviewAction =
|
||||
static_cast<KToggleAction*>(actionCollection()->action("show_preview"));
|
||||
const bool show = showPreviewAction->isChecked();
|
||||
m_activeViewContainer->view()->setShowPreview(show);
|
||||
}
|
||||
|
||||
void DolphinMainWindow::toggleShowHiddenFiles()
|
||||
void DolphinMainWindow::toggleShowHiddenFiles(bool show)
|
||||
{
|
||||
clearStatusBar();
|
||||
|
||||
const KToggleAction* showHiddenFilesAction =
|
||||
static_cast<KToggleAction*>(actionCollection()->action("show_hidden_files"));
|
||||
const bool show = showHiddenFilesAction->isChecked();
|
||||
m_activeViewContainer->view()->setShowHiddenFiles(show);
|
||||
}
|
||||
|
||||
void DolphinMainWindow::toggleFilterBarVisibility()
|
||||
void DolphinMainWindow::toggleFilterBarVisibility(bool show)
|
||||
{
|
||||
const KToggleAction* showFilterBarAction =
|
||||
static_cast<KToggleAction*>(actionCollection()->action("show_filter_bar"));
|
||||
const bool show = showFilterBarAction->isChecked();
|
||||
m_activeViewContainer->showFilterBar(show);
|
||||
}
|
||||
|
||||
|
@ -701,11 +685,9 @@ void DolphinMainWindow::toggleEditLocation()
|
|||
{
|
||||
clearStatusBar();
|
||||
|
||||
KToggleAction* action = static_cast<KToggleAction*>(actionCollection()->action("editable_location"));
|
||||
|
||||
bool editOrBrowse = action->isChecked();
|
||||
QAction* action = actionCollection()->action("editable_location");
|
||||
KUrlNavigator* urlNavigator = m_activeViewContainer->urlNavigator();
|
||||
urlNavigator->setUrlEditable(editOrBrowse);
|
||||
urlNavigator->setUrlEditable(action->isChecked());
|
||||
}
|
||||
|
||||
void DolphinMainWindow::editLocation()
|
||||
|
@ -978,6 +960,8 @@ void DolphinMainWindow::setupActions()
|
|||
viewModeGroup->addAction(columnView);
|
||||
connect(viewModeGroup, SIGNAL(triggered(QAction*)), this, SLOT(setViewMode(QAction*)));
|
||||
|
||||
// TODO use a QActionGroup
|
||||
|
||||
KToggleAction* sortByName = actionCollection()->add<KToggleAction>("sort_by_name");
|
||||
sortByName->setText(i18nc("@action:inmenu Sort By", "Name"));
|
||||
connect(sortByName, SIGNAL(triggered()), this, SLOT(sortByName()));
|
||||
|
@ -1046,22 +1030,17 @@ void DolphinMainWindow::setupActions()
|
|||
KAction* sortDescending = DolphinView::createSortDescendingAction(actionCollection());
|
||||
connect(sortDescending, SIGNAL(triggered()), this, SLOT(toggleSortOrder()));
|
||||
|
||||
KToggleAction* showInGroups = actionCollection()->add<KToggleAction>("show_in_groups");
|
||||
showInGroups->setText(i18nc("@action:inmenu View", "Show in Groups"));
|
||||
connect(showInGroups, SIGNAL(triggered()), this, SLOT(toggleSortCategorization()));
|
||||
KAction* showInGroups = DolphinView::createShowInGroupsAction(actionCollection());
|
||||
connect(showInGroups, SIGNAL(triggered(bool)), this, SLOT(toggleSortCategorization(bool)));
|
||||
|
||||
QActionGroup* showInformationActionGroup = DolphinView::createAdditionalInformationActionGroup(actionCollection());
|
||||
connect(showInformationActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(toggleAdditionalInfo(QAction*)));
|
||||
|
||||
KToggleAction* showPreview = actionCollection()->add<KToggleAction>("show_preview");
|
||||
showPreview->setText(i18nc("@action:intoolbar", "Preview"));
|
||||
showPreview->setIcon(KIcon("view-preview"));
|
||||
connect(showPreview, SIGNAL(triggered()), this, SLOT(togglePreview()));
|
||||
KAction* showPreview = DolphinView::createShowPreviewAction(actionCollection());
|
||||
connect(showPreview, SIGNAL(triggered(bool)), this, SLOT(togglePreview(bool)));
|
||||
|
||||
KToggleAction* showHiddenFiles = actionCollection()->add<KToggleAction>("show_hidden_files");
|
||||
showHiddenFiles->setText(i18nc("@action:inmenu View", "Show Hidden Files"));
|
||||
showHiddenFiles->setShortcut(Qt::ALT | Qt::Key_Period);
|
||||
connect(showHiddenFiles, SIGNAL(triggered()), this, SLOT(toggleShowHiddenFiles()));
|
||||
KAction* showHiddenFiles = DolphinView::createShowHiddenFilesAction(actionCollection());
|
||||
connect(showHiddenFiles, SIGNAL(triggered(bool)), this, SLOT(toggleShowHiddenFiles(bool)));
|
||||
|
||||
KAction* split = actionCollection()->addAction("split_view");
|
||||
split->setShortcut(Qt::Key_F3);
|
||||
|
@ -1116,7 +1095,7 @@ void DolphinMainWindow::setupActions()
|
|||
KToggleAction* showFilterBar = actionCollection()->add<KToggleAction>("show_filter_bar");
|
||||
showFilterBar->setText(i18nc("@action:inmenu Tools", "Show Filter Bar"));
|
||||
showFilterBar->setShortcut(Qt::CTRL | Qt::Key_I);
|
||||
connect(showFilterBar, SIGNAL(triggered()), this, SLOT(toggleFilterBarVisibility()));
|
||||
connect(showFilterBar, SIGNAL(triggered(bool)), this, SLOT(toggleFilterBarVisibility(bool)));
|
||||
|
||||
KAction* compareFiles = actionCollection()->addAction("compare_files");
|
||||
compareFiles->setText(i18nc("@action:inmenu Tools", "Compare Files"));
|
||||
|
@ -1277,8 +1256,7 @@ void DolphinMainWindow::updateViewActions()
|
|||
|
||||
QAction* action = actionCollection()->action(view->currentViewModeActionName());
|
||||
if (action != 0) {
|
||||
KToggleAction* toggleAction = static_cast<KToggleAction*>(action);
|
||||
toggleAction->setChecked(true);
|
||||
action->setChecked(true);
|
||||
}
|
||||
|
||||
slotSortingChanged(view->sorting());
|
||||
|
@ -1286,22 +1264,18 @@ void DolphinMainWindow::updateViewActions()
|
|||
slotCategorizedSortingChanged();
|
||||
slotAdditionalInfoChanged();
|
||||
|
||||
KToggleAction* showFilterBarAction =
|
||||
static_cast<KToggleAction*>(actionCollection()->action("show_filter_bar"));
|
||||
QAction* showFilterBarAction = actionCollection()->action("show_filter_bar");
|
||||
showFilterBarAction->setChecked(m_activeViewContainer->isFilterBarVisible());
|
||||
|
||||
KToggleAction* showPreviewAction =
|
||||
static_cast<KToggleAction*>(actionCollection()->action("show_preview"));
|
||||
QAction* showPreviewAction = actionCollection()->action("show_preview");
|
||||
showPreviewAction->setChecked(view->showPreview());
|
||||
|
||||
KToggleAction* showHiddenFilesAction =
|
||||
static_cast<KToggleAction*>(actionCollection()->action("show_hidden_files"));
|
||||
QAction* showHiddenFilesAction = actionCollection()->action("show_hidden_files");
|
||||
showHiddenFilesAction->setChecked(view->showHiddenFiles());
|
||||
|
||||
updateSplitAction();
|
||||
|
||||
KToggleAction* editableLocactionAction =
|
||||
static_cast<KToggleAction*>(actionCollection()->action("editable_location"));
|
||||
QAction* editableLocactionAction = actionCollection()->action("editable_location");
|
||||
const KUrlNavigator* urlNavigator = m_activeViewContainer->urlNavigator();
|
||||
editableLocactionAction->setChecked(urlNavigator->isUrlEditable());
|
||||
}
|
||||
|
|
|
@ -271,7 +271,7 @@ private slots:
|
|||
void toggleSortOrder();
|
||||
|
||||
/** Switches between sorting by categories or not. */
|
||||
void toggleSortCategorization();
|
||||
void toggleSortCategorization(bool);
|
||||
|
||||
/**
|
||||
* Switches on or off the displaying of additional information
|
||||
|
@ -293,19 +293,17 @@ private slots:
|
|||
void stopLoading();
|
||||
|
||||
/** Switches between showing a preview of the file content and showing the icon. */
|
||||
void togglePreview();
|
||||
void togglePreview(bool);
|
||||
|
||||
/**
|
||||
* Switches between showing and hiding of hidden marked files dependent
|
||||
* from the current state of the 'Show Hidden Files' menu toggle action.
|
||||
* Switches between showing and hiding of hidden marked files
|
||||
*/
|
||||
void toggleShowHiddenFiles();
|
||||
void toggleShowHiddenFiles(bool);
|
||||
|
||||
/**
|
||||
* Toggles between showing and hiding of the filter bar dependent
|
||||
* from the current state of the 'Show Filter Bar' menu toggle action.
|
||||
* Toggles between showing and hiding of the filter bar
|
||||
*/
|
||||
void toggleFilterBarVisibility();
|
||||
void toggleFilterBarVisibility(bool show);
|
||||
|
||||
/** Increases the size of the current set view mode. */
|
||||
void zoomIn();
|
||||
|
|
|
@ -93,6 +93,13 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QStringLi
|
|||
this, SLOT(slotUrlChanged(KUrl)));
|
||||
connect(m_view, SIGNAL(modeChanged()),
|
||||
this, SLOT(updateViewActions()));
|
||||
connect(m_view, SIGNAL(showPreviewChanged()),
|
||||
this, SLOT(slotShowPreviewChanged()));
|
||||
connect(m_view, SIGNAL(showHiddenFilesChanged()),
|
||||
this, SLOT(slotShowHiddenFilesChanged()));
|
||||
connect(m_view, SIGNAL(categorizedSortingChanged()),
|
||||
this, SLOT(slotCategorizedSortingChanged()));
|
||||
// TODO slotSortingChanged
|
||||
connect(m_view, SIGNAL(sortOrderChanged(Qt::SortOrder)),
|
||||
this, SLOT(slotSortOrderChanged(Qt::SortOrder)));
|
||||
connect(m_view, SIGNAL(additionalInfoChanged()),
|
||||
|
@ -110,7 +117,6 @@ DolphinPart::DolphinPart(QWidget* parentWidget, QObject* parent, const QStringLi
|
|||
// [Q_PROPERTY introspection?]
|
||||
|
||||
// TODO sort_by_* actions
|
||||
// TODO show_*_info actions
|
||||
|
||||
// TODO there was a "always open a new window" (when clicking on a directory) setting in konqueror
|
||||
// (sort of spacial navigation)
|
||||
|
@ -158,6 +164,15 @@ void DolphinPart::createActions()
|
|||
QActionGroup* showInformationActionGroup = DolphinView::createAdditionalInformationActionGroup(actionCollection());
|
||||
connect(showInformationActionGroup, SIGNAL(triggered(QAction*)), m_view, SLOT(toggleAdditionalInfo(QAction*)));
|
||||
|
||||
KAction* showPreview = DolphinView::createShowPreviewAction(actionCollection());
|
||||
connect(showPreview, SIGNAL(triggered(bool)), m_view, SLOT(setShowPreview(bool)));
|
||||
|
||||
KAction* showInGroups = DolphinView::createShowInGroupsAction(actionCollection());
|
||||
connect(showInGroups, SIGNAL(triggered(bool)), m_view, SLOT(setCategorizedSorting(bool)));
|
||||
|
||||
KAction* showHiddenFiles = DolphinView::createShowHiddenFilesAction(actionCollection());
|
||||
connect(showHiddenFiles, SIGNAL(triggered(bool)), m_view, SLOT(setShowHiddenFiles(bool)));
|
||||
|
||||
// Go menu
|
||||
|
||||
KAction* newDirAction = DolphinView::createNewDirAction(actionCollection());
|
||||
|
@ -457,4 +472,25 @@ void DolphinPart::slotAdditionalInfoChanged()
|
|||
m_view->updateAdditionalInfoActions(actionCollection());
|
||||
}
|
||||
|
||||
void DolphinPart::slotShowPreviewChanged()
|
||||
{
|
||||
updateViewActions(); // see DolphinMainWindow
|
||||
}
|
||||
|
||||
void DolphinPart::slotShowHiddenFilesChanged()
|
||||
{
|
||||
QAction* showHiddenFilesAction = actionCollection()->action("show_hidden_files");
|
||||
showHiddenFilesAction->setChecked(m_view->showHiddenFiles());
|
||||
}
|
||||
|
||||
void DolphinPart::slotCategorizedSortingChanged()
|
||||
{
|
||||
// Duplicated from DolphinMainWindow too.
|
||||
QAction* showInGroupsAction = actionCollection()->action("show_in_groups");
|
||||
showInGroupsAction->setChecked(m_view->categorizedSorting());
|
||||
showInGroupsAction->setEnabled(m_view->supportsCategorizedSorting());
|
||||
}
|
||||
|
||||
// TODO a DolphinViewActionHandler for reducing the duplication in the action handling
|
||||
|
||||
#include "dolphinpart.moc"
|
||||
|
|
|
@ -136,6 +136,15 @@ private Q_SLOTS:
|
|||
*/
|
||||
void createDir();
|
||||
|
||||
/** Updates the state of the 'Show preview' menu action. */
|
||||
void slotShowPreviewChanged();
|
||||
|
||||
/** Updates the state of the 'Show hidden files' menu action. */
|
||||
void slotShowHiddenFilesChanged();
|
||||
|
||||
/** Updates the state of the 'Categorized sorting' menu action. */
|
||||
void slotCategorizedSortingChanged();
|
||||
|
||||
/** Updates the state of the 'Sort Ascending/Descending' action. */
|
||||
void slotSortOrderChanged(Qt::SortOrder);
|
||||
|
||||
|
|
|
@ -1224,6 +1224,29 @@ KAction* DolphinView::createSortDescendingAction(KActionCollection* collection)
|
|||
return sortDescending;
|
||||
}
|
||||
|
||||
KAction* DolphinView::createShowPreviewAction(KActionCollection* collection)
|
||||
{
|
||||
KToggleAction* showPreview = collection->add<KToggleAction>("show_preview");
|
||||
showPreview->setText(i18nc("@action:intoolbar", "Preview"));
|
||||
showPreview->setIcon(KIcon("view-preview"));
|
||||
return showPreview;
|
||||
}
|
||||
|
||||
KAction* DolphinView::createShowInGroupsAction(KActionCollection* collection)
|
||||
{
|
||||
KToggleAction* showInGroups = collection->add<KToggleAction>("show_in_groups");
|
||||
showInGroups->setText(i18nc("@action:inmenu View", "Show in Groups"));
|
||||
return showInGroups;
|
||||
}
|
||||
|
||||
KAction* DolphinView::createShowHiddenFilesAction(KActionCollection* collection)
|
||||
{
|
||||
KToggleAction* showHiddenFiles = collection->add<KToggleAction>("show_hidden_files");
|
||||
showHiddenFiles->setText(i18nc("@action:inmenu View", "Show Hidden Files"));
|
||||
showHiddenFiles->setShortcut(Qt::ALT | Qt::Key_Period);
|
||||
return showHiddenFiles;
|
||||
}
|
||||
|
||||
QActionGroup* DolphinView::createAdditionalInformationActionGroup(KActionCollection* collection)
|
||||
{
|
||||
QActionGroup* showInformationGroup = new QActionGroup(collection);
|
||||
|
|
|
@ -164,39 +164,18 @@ public:
|
|||
* Changes the view mode for the current directory to \a mode.
|
||||
* If the view properties should be remembered for each directory
|
||||
* (GeneralSettings::globalViewProps() returns false), then the
|
||||
* changed view mode will be be stored automatically.
|
||||
* changed view mode will be stored automatically.
|
||||
*/
|
||||
void setMode(Mode mode);
|
||||
Mode mode() const;
|
||||
|
||||
/**
|
||||
* Turns on the file preview for the all files of the current directory,
|
||||
* if \a show is true.
|
||||
* If the view properties should be remembered for each directory
|
||||
* (GeneralSettings::globalViewProps() returns false), then the
|
||||
* preview setting will be be stored automatically.
|
||||
*/
|
||||
void setShowPreview(bool show);
|
||||
/** See setShowPreview */
|
||||
bool showPreview() const;
|
||||
|
||||
/**
|
||||
* Shows all hidden files of the current directory,
|
||||
* if \a show is true.
|
||||
* If the view properties should be remembered for each directory
|
||||
* (GeneralSettings::globalViewProps() returns false), then the
|
||||
* show hidden file setting will be be stored automatically.
|
||||
*/
|
||||
void setShowHiddenFiles(bool show);
|
||||
/** See setShowHiddenFiles */
|
||||
bool showHiddenFiles() const;
|
||||
|
||||
/**
|
||||
* Summarizes all sorted items by their category \a categorized
|
||||
* is true.
|
||||
* If the view properties should be remembered for each directory
|
||||
* (GeneralSettings::globalViewProps() returns false), then the
|
||||
* categorized sorting setting will be be stored automatically.
|
||||
*/
|
||||
void setCategorizedSorting(bool categorized);
|
||||
/** See setCategorizedSorting */
|
||||
bool categorizedSorting() const;
|
||||
|
||||
/**
|
||||
|
@ -379,6 +358,24 @@ public:
|
|||
*/
|
||||
static QActionGroup* createAdditionalInformationActionGroup(KActionCollection* collection);
|
||||
|
||||
/**
|
||||
* Creates the "show preview" action.
|
||||
* This code is here to share it between the mainwindow and the part
|
||||
*/
|
||||
static KAction* createShowPreviewAction(KActionCollection* collection);
|
||||
|
||||
/**
|
||||
* Creates the "show in groups" action.
|
||||
* This code is here to share it between the mainwindow and the part
|
||||
*/
|
||||
static KAction* createShowInGroupsAction(KActionCollection* collection);
|
||||
|
||||
/**
|
||||
* Creates the "show hidden files" action.
|
||||
* This code is here to share it between the mainwindow and the part
|
||||
*/
|
||||
static KAction* createShowHiddenFilesAction(KActionCollection* collection);
|
||||
|
||||
/**
|
||||
* Updates the state of the 'Additional Information' actions in \a collection.
|
||||
*/
|
||||
|
@ -439,6 +436,33 @@ public slots:
|
|||
/** Pastes the clipboard data to this view. */
|
||||
void paste();
|
||||
|
||||
/**
|
||||
* Turns on the file preview for the all files of the current directory,
|
||||
* if \a show is true.
|
||||
* If the view properties should be remembered for each directory
|
||||
* (GeneralSettings::globalViewProps() returns false), then the
|
||||
* preview setting will be stored automatically.
|
||||
*/
|
||||
void setShowPreview(bool show);
|
||||
|
||||
/**
|
||||
* Shows all hidden files of the current directory,
|
||||
* if \a show is true.
|
||||
* If the view properties should be remembered for each directory
|
||||
* (GeneralSettings::globalViewProps() returns false), then the
|
||||
* show hidden file setting will be stored automatically.
|
||||
*/
|
||||
void setShowHiddenFiles(bool show);
|
||||
|
||||
/**
|
||||
* Summarizes all sorted items by their category \a categorized
|
||||
* is true.
|
||||
* If the view properties should be remembered for each directory
|
||||
* (GeneralSettings::globalViewProps() returns false), then the
|
||||
* categorized sorting setting will be stored automatically.
|
||||
*/
|
||||
void setCategorizedSorting(bool categorized);
|
||||
|
||||
/** Switches between an ascending and descending sorting order. */
|
||||
void toggleSortOrder();
|
||||
|
||||
|
|
Loading…
Reference in a new issue