KDE
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   Web Development Archives Mailing Lists KDE

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Web Development Archives Sponsor:
  #1  
Old May 18th, 2008, 05:01 PM
Luigi Toscano
Guest
Dev Archives Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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>

Reply With Quote
Reply

Viewing: Web Development Archives Mailing Lists KDE > Please review: reduce "Open with" items in Konqueror


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway