- QList<QAction*> openWithActions;
- if (insertOpenWithItems) {
- // fill the 'Open with' sub menu with application types
- const KMimeType::Ptr mimePtr = KMimeType::findByUrl(m_fileInfo.url());
- KService::List offers = KMimeTypeTrader::self()->query(mimePtr->name(),
- "Application",
- "Type == 'Application'");
- if (offers.count() > 0) {
- KService::List::Iterator it;
- KMenu* openWithMenu = new KMenu(i18nc("@title:menu", "Open With"));
- for (it = offers.begin(); it != offers.end(); ++it) {
- // The offer list from the KTrader returns duplicate
- // application entries. Although this seems to be a configuration
- // problem outside the scope of Dolphin, duplicated entries just
- // will be skipped here.
- const QString appName((*it)->name());
- if (!containsEntry(openWithMenu, appName)) {
- const KIcon icon((*it)->icon());
- QAction* action = openWithMenu->addAction(icon, appName);
- openWithVector.append(*it);
- openWithActions << action;
- }
- }
-
- openWithMenu->addSeparator();
- QAction* action = openWithMenu->addAction(i18nc("@action:inmenu Open With", "&Other..."));
-
- openWithActions << action;
- popup->addMenu(openWithMenu);
+KFileItem DolphinContextMenu::baseFileItem()
+{
+ if (!m_baseFileItem) {
+ const DolphinView *view = m_mainWindow->activeViewContainer()->view();
+ KFileItem baseItem = view->rootItem();
+ if (baseItem.isNull() || baseItem.url() != m_baseUrl) {
+ m_baseFileItem = new KFileItem(m_baseUrl);