Changeset View
Changeset View
Standalone View
Standalone View
containments/desktop/plugins/folder/foldermodel.cpp
Show First 20 Lines • Show All 1767 Lines • ▼ Show 20 Line(s) | 1765 | if (KConfigGroup(dolphin, "General").readEntry("ShowCopyMoveMenu", false)) { | |||
---|---|---|---|---|---|
1768 | m_copyToMenu->addActionsTo(menu); | 1768 | m_copyToMenu->addActionsTo(menu); | ||
1769 | menu->addSeparator(); | 1769 | menu->addSeparator(); | ||
1770 | } | 1770 | } | ||
1771 | 1771 | | |||
1772 | // Properties | 1772 | // Properties | ||
1773 | if (KPropertiesDialog::canDisplay(items)) { | 1773 | if (KPropertiesDialog::canDisplay(items)) { | ||
1774 | QAction *act = new QAction(menu); | 1774 | QAction *act = new QAction(menu); | ||
1775 | act->setText(i18n("&Properties")); | 1775 | act->setText(i18n("&Properties")); | ||
1776 | QObject::connect(act, &QAction::triggered, [this, items]() { | 1776 | QObject::connect(act, &QAction::triggered, this, &FolderModel::openPropertiesDialog); | ||
1777 | KPropertiesDialog::showDialog(items, nullptr, false /*non modal*/); | | |||
1778 | }); | | |||
1779 | menu->addAction(act); | 1777 | menu->addAction(act); | ||
1780 | } | 1778 | } | ||
1781 | 1779 | | |||
1782 | } | 1780 | } | ||
1783 | 1781 | | |||
1784 | if (visualParent) { | 1782 | if (visualParent) { | ||
1785 | m_menuPosition = visualParent->mapToGlobal(QPointF(0, visualParent->height())).toPoint(); | 1783 | m_menuPosition = visualParent->mapToGlobal(QPointF(0, visualParent->height())).toPoint(); | ||
1786 | } else { | 1784 | } else { | ||
1787 | m_menuPosition = QCursor::pos(); | 1785 | m_menuPosition = QCursor::pos(); | ||
1788 | } | 1786 | } | ||
1789 | menu->popup(m_menuPosition); | 1787 | menu->popup(m_menuPosition); | ||
1790 | connect(menu, &QMenu::aboutToHide, [menu]() { menu->deleteLater(); }); | 1788 | connect(menu, &QMenu::aboutToHide, [menu]() { menu->deleteLater(); }); | ||
1791 | } | 1789 | } | ||
1792 | 1790 | | |||
1791 | void FolderModel::openPropertiesDialog() | ||||
1792 | { | ||||
1793 | const QModelIndexList indexes = m_selectionModel->selectedIndexes(); | ||||
1794 | if (indexes.isEmpty()) { | ||||
1795 | return; | ||||
1796 | } | ||||
1797 | | ||||
1798 | KFileItemList items; | ||||
1799 | items.reserve(indexes.count()); | ||||
1800 | for (const QModelIndex &index : indexes) { | ||||
1801 | KFileItem item = itemForIndex(index); | ||||
1802 | if (!item.isNull()) { | ||||
1803 | items.append(item); | ||||
1804 | } | ||||
1805 | } | ||||
1806 | | ||||
1807 | if (!KPropertiesDialog::canDisplay(items)) { | ||||
1808 | return; | ||||
1809 | } | ||||
1810 | | ||||
1811 | KPropertiesDialog::showDialog(items, nullptr, false /*non modal*/); | ||||
1812 | } | ||||
1813 | | ||||
1793 | void FolderModel::linkHere(const QUrl &sourceUrl) | 1814 | void FolderModel::linkHere(const QUrl &sourceUrl) | ||
1794 | { | 1815 | { | ||
1795 | KIO::CopyJob *job = KIO::link(sourceUrl, m_dirModel->dirLister()->url()); | 1816 | KIO::CopyJob *job = KIO::link(sourceUrl, m_dirModel->dirLister()->url()); | ||
1796 | KIO::FileUndoManager::self()->recordCopyJob(job); | 1817 | KIO::FileUndoManager::self()->recordCopyJob(job); | ||
1797 | } | 1818 | } | ||
1798 | 1819 | | |||
1799 | QList<QUrl> FolderModel::selectedUrls() const | 1820 | QList<QUrl> FolderModel::selectedUrls() const | ||
1800 | { | 1821 | { | ||
▲ Show 20 Lines • Show All 167 Lines • Show Last 20 Lines |