Bug 57413 - Kappfinder shouldnt show already existing elements on menu
Summary: Kappfinder shouldnt show already existing elements on menu
Status: RESOLVED FIXED
Alias: None
Product: kappfinder
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR minor
Target Milestone: ---
Assignee: Matthias Hoelzer-Kluepfel
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-04-18 11:00 UTC by Ismail Donmez
Modified: 2004-01-14 19:16 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Patch against latest cvs (1.82 KB, patch)
2003-04-28 15:07 UTC, Ismail Donmez
Details
Better patch against latest cvs (1.28 KB, patch)
2003-04-29 12:13 UTC, Ismail Donmez
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ismail Donmez 2003-04-18 11:00:27 UTC
Version:            (using KDE Devel)
Compiler:          gcc 3.2.2 
OS:          Linux

Kappfinder shows already existing elements. Like I got Gimp link on Graphics menu but whenever I run kappfinder it still shows Gimp to be added to menu. Instead it should check if the element is already existing in the menu and dont show the existing ones.
Comment 1 Ismail Donmez 2003-04-18 13:52:37 UTC
I do not think this is a wishlist but a normal bug. Kappfinder supposed to find non-existing 
programs on menu not already existing ones... 
Comment 2 Ismail Donmez 2003-04-28 15:07:48 UTC
Created attachment 1449 [details]
Patch against latest cvs

Fixes the problem.
Comment 3 Ismail Donmez 2003-04-29 12:13:16 UTC
Created attachment 1455 [details]
Better patch against latest cvs

Do not crash when de/select all. Show the right installed application count.
Remove some obsolete things..
Comment 4 Ismail Donmez 2003-05-10 23:41:13 UTC
Can you please review/apply this patch? 
Comment 5 Stephan Binner 2003-08-30 20:24:25 UTC
Does it work with the new implemented XDG Desktop Menu specification? Isn't it 
planned to integrate kappfinder into kmenuedit? 
Comment 6 Ismail Donmez 2003-08-31 10:35:23 UTC
Tobias told me he was waiting for Bastian to finish XDG work. 
Comment 7 Waldo Bastian 2003-09-01 10:48:32 UTC
Patches don't look right to me. Will look into it later this week.  
 
Apart from that someone (Tobias?) may want to add categories to the .desktop files 
installed by kappfinder so that they can be installed to the new XDG locations later 
on. 
Comment 8 Ismail Donmez 2003-09-01 14:57:38 UTC
Patches are done before XDG introduced in KDE. 
Comment 9 Dirk Mueller 2003-11-02 18:26:30 UTC
its a bug, not a wishlist. 
Comment 10 Waldo Bastian 2004-01-14 19:16:59 UTC
Subject: kdebase/kappfinder

CVS commit by waba: 

Don't show already installed applications. (BR57413)
CCMAIL: 57413-done@bugs.kde.org


  M +31 -2     toplevel.cpp   1.17


--- kdebase/kappfinder/toplevel.cpp  #1.16:1.17
@@ -30,4 +30,5 @@
 #include <kmessagebox.h>
 #include <kprogress.h>
+#include <kservice.h>
 #include <kservicegroup.h>
 #include <kstandarddirs.h>
@@ -64,7 +65,10 @@ TopLevel::TopLevel( const QString &destD
   mListView->setMinimumSize( 300, 300 );
   mListView->setRootIsDecorated( true );
+  mListView->setAllColumnsShowFocus( true );
+  mListView->setSelectionMode(QListView::NoSelection);
   layout->addWidget( mListView );
 
   mProgress = new KProgress( this );
+  mProgress->setPercentageVisible( false );
   layout->addWidget( mProgress );
 
@@ -167,4 +171,5 @@ void TopLevel::slotScan()
 
   mScanButton->setEnabled( false );
+  mProgress->setPercentageVisible( true );
   mProgress->setTotalSteps( count );
   mProgress->setValue( 0 );
@@ -174,9 +179,29 @@ void TopLevel::slotScan()
   QStringList::Iterator it;
   for ( it = mTemplates.begin(); it != mTemplates.end(); ++it ) {
-    KDesktopFile desktop( *it, true );
-
     // eye candy
     mProgress->setProgress( mProgress->progress() + 1 );
 
+    QString desktopName = *it;
+    int i = desktopName.findRev('/');
+    desktopName = desktopName.mid(i+1);
+    i = desktopName.findRev('.');
+    if (i != -1)
+       desktopName = desktopName.left(i);
+
+    bool found;
+    found = KService::serviceByDesktopName(desktopName);
+    if (found)
+       continue;
+
+    found = KService::serviceByMenuId("kde-"+desktopName+".desktop");
+    if (found)
+       continue; 
+
+    found = KService::serviceByMenuId("gnome-"+desktopName+".desktop");
+    if (found)
+       continue; 
+
+    KDesktopFile desktop( *it, true );
+
     // copy over the desktop file, if exists
     if ( scanDesktopFile( mAppCache, *it, mDestDir ) ) {
@@ -223,4 +248,6 @@ void TopLevel::slotScan()
   // stop scanning
   mProgress->setValue( 0 );
+  mProgress->setPercentageVisible( false );
+
   mScanButton->setEnabled( true );
 
@@ -255,4 +282,6 @@ void TopLevel::slotCreate()
   decorateDirs( mDestDir );
 
+  KService::rebuildKSycoca(this);
+
   QString message( i18n( "%n application was added to the KDE menu system.",
                          "%n applications were added to the KDE menu system.", mAdded ) );