]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/dolphinmainwindow.cpp
SVN_SILENT made messages (.desktop file) - always resolve ours
[dolphin.git] / src / dolphinmainwindow.cpp
index 75a340f0a5e14aa0b7b7432158cbb99384ff0337..cd4800b7dc491ba34c54057dc89f2e345ed23ac7 100644 (file)
@@ -142,7 +142,7 @@ DolphinMainWindow::DolphinMainWindow() :
 
     m_actionHandler = new DolphinViewActionHandler(actionCollection(), this);
     connect(m_actionHandler, &DolphinViewActionHandler::actionBeingHandled, this, &DolphinMainWindow::clearStatusBar);
-    connect(m_actionHandler, &DolphinViewActionHandler::createDirectory, this, &DolphinMainWindow::createDirectory);
+    connect(m_actionHandler, &DolphinViewActionHandler::createDirectoryTriggered, this, &DolphinMainWindow::createDirectory);
 
     m_remoteEncoding = new DolphinRemoteEncoding(this, m_actionHandler);
     connect(this, &DolphinMainWindow::urlChanged,
@@ -995,7 +995,6 @@ void DolphinMainWindow::activeViewChanged(DolphinViewContainer* viewContainer)
 void DolphinMainWindow::tabCountChanged(int count)
 {
     const bool enableTabActions = (count > 1);
-    actionCollection()->action(KStandardAction::name(KStandardAction::Close))->setEnabled(enableTabActions);
     actionCollection()->action(QStringLiteral("activate_next_tab"))->setEnabled(enableTabActions);
     actionCollection()->action(QStringLiteral("activate_prev_tab"))->setEnabled(enableTabActions);
 }
@@ -1038,6 +1037,7 @@ void DolphinMainWindow::setupActions()
 
     QAction* newWindow = KStandardAction::openNew(this, &DolphinMainWindow::openNewMainWindow, actionCollection());
     newWindow->setText(i18nc("@action:inmenu File", "New &Window"));
+    newWindow->setIcon(QIcon::fromTheme(QStringLiteral("window-new")));
 
     QAction* newTab = actionCollection()->addAction(QStringLiteral("new_tab"));
     newTab->setIcon(QIcon::fromTheme(QStringLiteral("tab-new")));
@@ -1048,7 +1048,6 @@ void DolphinMainWindow::setupActions()
     QAction* closeTab = KStandardAction::close(
             m_tabWidget, static_cast<void(DolphinTabWidget::*)()>(&DolphinTabWidget::closeTab), actionCollection());
     closeTab->setText(i18nc("@action:inmenu File", "Close Tab"));
-    closeTab->setEnabled(false);
 
     KStandardAction::quit(this, &DolphinMainWindow::quit, actionCollection());
 
@@ -1337,6 +1336,20 @@ void DolphinMainWindow::setupDockWidgets()
             this, &DolphinMainWindow::slotStorageTearDownExternallyRequested);
     m_tabWidget->slotPlacesPanelVisibilityChanged(m_placesPanel->isVisible());
 
+    auto actionShowAllPlaces = new QAction(QIcon::fromTheme(QStringLiteral("hint")), i18nc("@item:inmenu", "Show Hidden Places"), this);
+    actionShowAllPlaces->setCheckable(true);
+    actionShowAllPlaces->setDisabled(true);
+
+    connect(actionShowAllPlaces, &QAction::triggered, this, [actionShowAllPlaces, this](bool checked){
+        actionShowAllPlaces->setIcon(QIcon::fromTheme(checked ? QStringLiteral("visibility") : QStringLiteral("hint")));
+        m_placesPanel->showHiddenEntries(checked);
+    });
+
+    connect(m_placesPanel, &PlacesPanel::showHiddenEntriesChanged, this, [actionShowAllPlaces] (bool checked){
+        actionShowAllPlaces->setChecked(checked);
+        actionShowAllPlaces->setIcon(QIcon::fromTheme(checked ? QStringLiteral("visibility") : QStringLiteral("hint")));
+   });
+
     // Add actions into the "Panels" menu
     KActionMenu* panelsMenu = new KActionMenu(i18nc("@action:inmenu View", "Panels"), this);
     actionCollection()->addAction(QStringLiteral("panels"), panelsMenu);
@@ -1349,7 +1362,12 @@ void DolphinMainWindow::setupDockWidgets()
     panelsMenu->addAction(ac->action(QStringLiteral("show_folders_panel")));
     panelsMenu->addAction(ac->action(QStringLiteral("show_terminal_panel")));
     panelsMenu->addSeparator();
+    panelsMenu->addAction(actionShowAllPlaces);
     panelsMenu->addAction(lockLayoutAction);
+
+    connect(panelsMenu->menu(), &QMenu::aboutToShow, this, [actionShowAllPlaces, this]{
+        actionShowAllPlaces->setEnabled(m_placesPanel->hiddenListCount());
+    });
 }
 
 void DolphinMainWindow::updateEditActions()