Changeset View
Changeset View
Standalone View
Standalone View
src/widgets/kfileitemactions.cpp
Show First 20 Lines • Show All 601 Lines • ▼ Show 20 Line(s) | 594 | { | |||
---|---|---|---|---|---|
602 | //// Ok, we have everything, now insert | 602 | //// Ok, we have everything, now insert | ||
603 | 603 | | |||
604 | const KFileItemList items = d->m_props.items(); | 604 | const KFileItemList items = d->m_props.items(); | ||
605 | const KFileItem firstItem = items.first(); | 605 | const KFileItem firstItem = items.first(); | ||
606 | const bool isLocal = firstItem.url().isLocalFile(); | 606 | const bool isLocal = firstItem.url().isLocalFile(); | ||
607 | // "Open With..." for folders is really not very useful, especially for remote folders. | 607 | // "Open With..." for folders is really not very useful, especially for remote folders. | ||
608 | // (media:/something, or trash:/, or ftp://...) | 608 | // (media:/something, or trash:/, or ftp://...) | ||
609 | if (!d->m_props.isDirectory() || isLocal) { | 609 | if (!d->m_props.isDirectory() || isLocal) { | ||
610 | if (!topMenu->actions().isEmpty()) { | | |||
611 | topMenu->addSeparator(); | | |||
elvisangelaccio: Why are we removing this separator? | |||||
612 | } | | |||
613 | 610 | | |||
614 | QAction *runAct = new QAction(this); | 611 | QAction *runAct = new QAction(this); | ||
615 | QString runActionName; | 612 | QString runActionName; | ||
616 | 613 | | |||
617 | const QStringList serviceIdList = d->listPreferredServiceIds(d->m_mimeTypeList, traderConstraint); | 614 | const QStringList serviceIdList = d->listPreferredServiceIds(d->m_mimeTypeList, traderConstraint); | ||
618 | //qDebug() << "serviceIdList=" << serviceIdList; | 615 | //qDebug() << "serviceIdList=" << serviceIdList; | ||
619 | 616 | | |||
620 | // When selecting files with multiple mimetypes, offer either "open with <app for all>" | 617 | // When selecting files with multiple mimetypes, offer either "open with <app for all>" | ||
Show All 23 Lines | 619 | if (d->m_mimeTypeList.count() > 1 | |||
644 | d->m_traderConstraint = traderConstraint; | 641 | d->m_traderConstraint = traderConstraint; | ||
645 | d->m_fileOpenList = d->m_props.items(); | 642 | d->m_fileOpenList = d->m_props.items(); | ||
646 | QObject::connect(runAct, SIGNAL(triggered()), d, SLOT(slotRunPreferredApplications())); | 643 | QObject::connect(runAct, SIGNAL(triggered()), d, SLOT(slotRunPreferredApplications())); | ||
647 | topMenu->addAction(runAct); | 644 | topMenu->addAction(runAct); | ||
648 | } | 645 | } | ||
649 | 646 | | |||
650 | if (!offers.isEmpty()) { | 647 | if (!offers.isEmpty()) { | ||
651 | QMenu *menu = topMenu; | 648 | QMenu *menu = topMenu; | ||
649 | QAction *act; | ||||
652 | 650 | | |||
653 | // Always show the top app inline | 651 | // Show the top app inline for files, but not folders | ||
654 | QAction *act = d->createAppAction(offers.takeFirst(), true); | 652 | if (!d->m_props.isDirectory()) { | ||
653 | act = d->createAppAction(offers.takeFirst(), true); | ||||
655 | menu->addAction(act); | 654 | menu->addAction(act); | ||
655 | } | ||||
656 | 656 | | |||
657 | // If there are still more apps, show them in a sub-menu | 657 | // If there are still more apps, show them in a sub-menu | ||
658 | if (!offers.isEmpty()) { // submenu 'open with' | 658 | if (!offers.isEmpty()) { // submenu 'open with' | ||
659 | menu = new QMenu(i18nc("@title:menu", "&Open With"), topMenu); | 659 | menu = new QMenu(i18nc("@title:menu", "&Open With"), topMenu); | ||
660 | menu->menuAction()->setObjectName(QStringLiteral("openWith_submenu")); // for the unittest | 660 | menu->menuAction()->setObjectName(QStringLiteral("openWith_submenu")); // for the unittest | ||
661 | topMenu->addMenu(menu); | 661 | topMenu->addMenu(menu); | ||
662 | 662 | | |||
663 | // Add other apps to the sub-menu | 663 | // Add other apps to the sub-menu | ||
▲ Show 20 Lines • Show All 157 Lines • Show Last 20 Lines |
Why are we removing this separator?