|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Please review: reduce "Open with" items in Konqueror
Hi,
many people complained about the number of "open with" items in the Konqueror File menu (or, at least, _I_ complained about it :). The attached patch makes the number of those item configurable using an hidden kconfig option. The remaining items are shown in a submenu. If you think it's good enough, I would like to commit it before the freeze (tomorrow). If not, I'll wait for 4.2 :) Regards, -- Luigi Index: konqueror/src/konqueror.kcfg konqueror/src/konqueror.kcfg (revision 809395) konqueror/src/konqueror.kcfg (working copy) @@ -146,6 +146,12 @@ <whatsthis></whatsthis> <!-- checked </entry> + <entry key="WithItems" type="Int"> + <default>2</default> + <label></label> + <whatsthis></whatsthis> + <!-- no writeEntry / hidden + </entry> </group> <group name="HTML Settings" > Index: (revision 809395) (working copy) @@ -17,6 +17,7 @@ <Action name="print"/> <DefineGroup name="print" /> <Separator/> + <ActionList name="openwithbase" /> <ActionList name="openwith" /<! termination separator <Action name="quit"/> </Menu> Index: (revision 809395) (working copy) @@ -17,6 +17,7 @@ <Action name="print"/> <DefineGroup name="print" /> <Separator/> + <ActionList name="openwithbase"/> <ActionList name="openwith" /<! termination separator <Action name="quit"/> </Menu> Index: konqueror/src/konqmainwindow.h konqueror/src/konqmainwindow.h (revision 809395) konqueror/src/konqmainwindow.h (working copy) @@ -725,6 +725,7 @@ QString m_initialFrameName; QList<QAction *m_openWithActions; + KActionMenu *m_openWithMenu; KActionMenu *m_viewModeMenu; QActionGroup* m_viewModesGroup; QActionGroup* m_closedItemsGroup; Index: (revision 809395) (working copy) @@ -218,6 +218,7 @@ m_toggleViewGUIClient = new ToggleViewGUIClient( this ); m_viewModeMenu = 0; + m_openWithMenu = 0; m_paCopyFiles = 0; m_paMoveFiles = 0; m_bookmarkBarInitialized = false; @@ -4851,35 +4852,60 @@ void KonqMainWindow::WithActions() { + unplugActionList( "openwithbase" ); unplugActionList( "openwith" ); qDeleteAll(m_openWithActions); m_openWithActions.clear(); + delete m_openWithMenu; + m_openWithMenu = 0; + if (!KAuthorized::authorizeKAction("openwith")) return; + m_openWithMenu = new KActionMenu( i18n(" wit&h"), this ); + const KService::List & services = m_currentView->appS(); KService::List::ConstIterator it = services.begin(); const KService::List::ConstIterator end = services.end(); - for (; it != end; ++it ) + + int WithItems = qMax( KonqSettings::openWithItems(), 0 ); + + int idxService = 0; + for (; it != end; ++it, ++idxService ) { - QAction *action = actionCollection()->addAction( (*it)->desktopEntryName().toLatin1() ); - action->setText( i18n( " with %1", (*it)->name() ) ); + QAction *action; + + if ( idxService < WithItems ) + action = new QAction( i18n( " wit&h %1", QString((*it)->name()) ), this ); + else + action = new QAction( i18n( "%1", QString((*it)->name()) ), this ); action->setIcon( KIcon( (*it)->icon() ) ); connect( action, SIGNAL( activated() ), this, SLT( With() ) ); - m_openWithActions.append( action ); + actionCollection()->addAction((*it)->desktopEntryName().toLatin1(), action); + if ( idxService < WithItems ) + m_openWithActions.append( action ); + else + m_openWithMenu->addAction( action ); } + if ( services.count() 0 ) { + plugActionList( "openwithbase", m_openWithActions ); + QList<QAction*openWithActionsMenu; + if ( idxService WithItems ) + { + openWithActionsMenu.append( m_openWithMenu ); + } QAction *sep = new QAction( this ); sep->setSeparator( true ); - m_openWithActions.append( sep ); - plugActionList( "openwith", m_openWithActions ); - } + openWithActionsMenu.append( sep ); + plugActionList( "openwith", openWithActionsMenu ); + } } void () Index: konqueror/src/konqueror.rc konqueror/src/konqueror.rc (revision 809395) konqueror/src/konqueror.rc (working copy) @@ -17,6 +17,7 @@ <Action name="print"/> <DefineGroup name="print" /> <Separator/> + <ActionList name="openwithbase"/> <ActionList name="openwith" /<! termination separator <Action name="quit"/> </Menu> Index: (revision 809395) (working copy) @@ -16,6 +16,7 @@ <Action name="print" /> <DefineGroup name="print" /> <Separator/> + <ActionList name="openwithbase"/> <ActionList name="openwith" /> <Action name="quit" /> </Menu> |
![]() |
| Viewing: Web Development Archives > Mailing Lists > KDE > Please review: reduce "Open with" items in Konqueror |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|