[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/4.5/kdelibs/kio/kio
From:       David Faure <faure () kde ! org>
Date:       2010-07-22 12:50:21
Message-ID: 20100722125021.F404DAC7AB () svn ! kde ! org
[Download RAW message or body]

SVN commit 1153046 by dfaure:

Fix duplicated app entries showing up in the context menu (e.g. for zip files) due to
the two pieces of code (default app for all selected mimes, and standard offer list)
both showing the same entry. Was introduced by http://reviewboard.kde.org/r/3163.
FIXED-FOR: 4.5.0
BUG: 242731
CCMAIL: toddrme2178@gmail.com


 M  +16 -2     kfileitemactions.cpp  


--- branches/KDE/4.5/kdelibs/kio/kio/kfileitemactions.cpp #1153045:1153046
@@ -494,7 +494,7 @@
 void KFileItemActions::addOpenWithActionsTo(QMenu* topMenu, const QString& \
traderConstraint)  {
     d->m_traderConstraint = traderConstraint;
-    const KService::List offers = associatedApplications(d->m_mimeTypeList, \
traderConstraint); +    KService::List offers = \
associatedApplications(d->m_mimeTypeList, traderConstraint);  
     //// Ok, we have everything, now insert
 
@@ -513,14 +513,28 @@
 
 
         const QStringList serviceIdList = \
d->listPreferredServiceIds(d->m_mimeTypeList, traderConstraint); +        \
//kDebug(7010) << "serviceIdList=" << serviceIdList;  
-        if (serviceIdList.count() != 0 && !(serviceIdList.count()==1 && \
serviceIdList.first().isEmpty())) { +        // When selecting files with multiple \
mimetypes, offer either "open with <app for all>" +        // or a generic <open> (if \
there are any apps associated). +        if (d->m_mimeTypeList.count() > 1
+            && !serviceIdList.isEmpty()
+            && !(serviceIdList.count()==1 && serviceIdList.first().isEmpty())) { // \
empty means "no apps associated" +
             d->m_ownActions.append(runAct);
 
             if (serviceIdList.count() == 1) {
                 const KService::Ptr app = \
preferredService(d->m_mimeTypeList.first(), traderConstraint);  runActionName = \
i18n("&Open with %1", app->name());  runAct->setIcon(KIcon(app->icon()));
+
+                // Remove that app from the offers list (#242731)
+                for (int i = 0; i < offers.count() ; ++i) {
+                    if (offers[i]->storageId() == app->storageId()) {
+                        offers.removeAt(i);
+                        break;
+                    }
+                }
             } else {
                 runActionName = i18n("&Open");
             }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic