Changeset View
Changeset View
Standalone View
Standalone View
src/dolphinmainwindow.cpp
Show First 20 Lines • Show All 451 Lines • ▼ Show 20 Line(s) | 451 | { | |||
---|---|---|---|---|---|
452 | m_tabWidget->readProperties(group); | 452 | m_tabWidget->readProperties(group); | ||
453 | } | 453 | } | ||
454 | 454 | | |||
455 | void DolphinMainWindow::updateNewMenu() | 455 | void DolphinMainWindow::updateNewMenu() | ||
456 | { | 456 | { | ||
457 | m_newFileMenu->setViewShowsHiddenFiles(activeViewContainer()->view()->hiddenFilesShown()); | 457 | m_newFileMenu->setViewShowsHiddenFiles(activeViewContainer()->view()->hiddenFilesShown()); | ||
458 | m_newFileMenu->checkUpToDate(); | 458 | m_newFileMenu->checkUpToDate(); | ||
459 | m_newFileMenu->setPopupFiles(activeViewContainer()->url()); | 459 | m_newFileMenu->setPopupFiles(activeViewContainer()->url()); | ||
460 | | ||||
461 | // If we're in the trash, also disable all the 'create new' items | | |||
462 | // TODO: remove this once https://phabricator.kde.org/T8234 is implemented | | |||
463 | slotWriteStateChanged(m_activeViewContainer->view()->url().scheme() != QLatin1String("trash")); | | |||
464 | } | 460 | } | ||
465 | 461 | | |||
466 | void DolphinMainWindow::createDirectory() | 462 | void DolphinMainWindow::createDirectory() | ||
467 | { | 463 | { | ||
468 | m_newFileMenu->setViewShowsHiddenFiles(activeViewContainer()->view()->hiddenFilesShown()); | 464 | m_newFileMenu->setViewShowsHiddenFiles(activeViewContainer()->view()->hiddenFilesShown()); | ||
469 | m_newFileMenu->setPopupFiles(activeViewContainer()->url()); | 465 | m_newFileMenu->setPopupFiles(activeViewContainer()->url()); | ||
470 | m_newFileMenu->createDirectory(); | 466 | m_newFileMenu->createDirectory(); | ||
471 | } | 467 | } | ||
▲ Show 20 Lines • Show All 331 Lines • ▼ Show 20 Line(s) | 798 | if (entry.isDir()) { | |||
803 | activeViewContainer()->setUrl(url); | 799 | activeViewContainer()->setUrl(url); | ||
804 | } else { | 800 | } else { | ||
805 | new KRun(url, this); // Automatically deletes itself after being finished | 801 | new KRun(url, this); // Automatically deletes itself after being finished | ||
806 | } | 802 | } | ||
807 | } | 803 | } | ||
808 | 804 | | |||
809 | void DolphinMainWindow::slotWriteStateChanged(bool isFolderWritable) | 805 | void DolphinMainWindow::slotWriteStateChanged(bool isFolderWritable) | ||
810 | { | 806 | { | ||
811 | const auto actions = m_newFileMenu->menu()->actions(); | 807 | // trash:/ is writable but we don't want to create new items in it. | ||
812 | for (auto menuItem : actions) { | 808 | // TODO: remove the trash check once https://phabricator.kde.org/T8234 is implemented | ||
813 | menuItem->setEnabled(isFolderWritable); | 809 | newFileMenu()->setEnabled(isFolderWritable && m_activeViewContainer->url().scheme() != QLatin1String("trash")); | ||
814 | } | | |||
815 | } | 810 | } | ||
816 | 811 | | |||
817 | void DolphinMainWindow::openContextMenu(const QPoint& pos, | 812 | void DolphinMainWindow::openContextMenu(const QPoint& pos, | ||
818 | const KFileItem& item, | 813 | const KFileItem& item, | ||
819 | const QUrl& url, | 814 | const QUrl& url, | ||
820 | const QList<QAction*>& customActions) | 815 | const QList<QAction*>& customActions) | ||
821 | { | 816 | { | ||
822 | QPointer<DolphinContextMenu> contextMenu = new DolphinContextMenu(this, pos, item, url); | 817 | QPointer<DolphinContextMenu> contextMenu = new DolphinContextMenu(this, pos, item, url); | ||
▲ Show 20 Lines • Show All 803 Lines • Show Last 20 Lines |