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

List:       kde-devel
Subject:    Re: kfm binding related bugs
From:       Rene Beutler <rbeutler () g26 ! ethz ! ch>
Date:       1998-11-06 14:41:49
[Download RAW message or body]

Hi,

> Ok. Let's settle it then : I'll take care of patches about kfm in general 
(GUI, 
> configuration, SM, bugs...) and you'll take care of khtmlw and the use kfm 
makes of it
> if necessary.
> 

well then, here are my kfm patches which Torben didn't apply. kfmman, kfmprops 
and root are for the binding related bugs and kfmgui is a little speedup.

thanx for your work and a nice weekend!

regards
Rene

---

rbeutler@g26.ethz.ch

>  ____________________________________________________________________
> |                                                                    |
> |  David FAURE                                                       |
> |  E-mail : David.Faure@insa-lyon.fr, faure@kde.org                  |
> |  http://www.insa-lyon.fr/People/AEDI/dfaure/index.html             |
> |____________________________________________________________________|
> 

["kfmgui.cpp.diff" (TEXT/plain)]

--- kfmgui.cpp.orig	Sun Oct 11 10:31:04 1998
+++ kfmgui.cpp	Sun Oct 11 10:23:48 1998
@@ -929,8 +929,7 @@
 
 void KfmGui::slotSelectAll()
 {
-	QRegExp re( "*", true, true );
-	view->getActiveView()->select( re, true );
+	view->getActiveView()->select( 0L, true );
 }
 
 void KfmGui::slotBookmarksChanged()

["kfmman.cpp.diff" (TEXT/plain)]

--- kdebase/kfm/kfmman.cpp.orig	Tue Nov  3 00:12:58 1998
+++ kdebase/kfm/kfmman.cpp	Tue Nov  3 10:30:10 1998
@@ -1025,16 +1025,19 @@
     {
 	// Run the action 'txt' on every single file
 	KMimeBind::runBinding( s, txt );    
     }
 }
 
 void KFMManager::openPopupMenu( QStrList &_urls, const QPoint & _point, bool _current_dir )
 {
+    // please note that this code is strongly related to
+    // root.cpp: void KRootWidget::openPopupMenu( ... )
+
     // Check wether all URLs are correct
     char *s;
     for ( s = _urls.first(); s != 0L; s = _urls.next() )
     {
 	KURL u( s );
 	if ( u.isMalformed() )
 	{
 	    QString tmp;
@@ -1137,36 +1140,40 @@
 	// If this is the first file in the list, assume that all bindings are ok
 	if ( s == _urls.getFirst() )
 	{
 	    KMimeType::getBindings( bindings, pixlist, s, isdir );
 	}
 	// Take only bindings, matching all files.
 	else
 	{
+	    bindings2.clear(); 
+	    pixlist2.clear();
 	    KMimeType::getBindings( bindings2, pixlist2, s, isdir );
 	    char *b;
 	    QPixmap *p = pixlist.first();
+	    bindings3.clear();
+	    pixlist3.clear();
 	    // Look thru all bindings we have so far
 	    for ( b = bindings.first(); b != 0L; b = bindings.next() )
 	    {
 		// Does the binding match this file, too
-		// and don't we already have this binding?
-		if ( ( bindings2.find( b ) != -1 ) &&	
-		     ( bindings3.find( b ) == -1  ) )
+		if ( bindings2.find( b ) != -1  )
 		{
 		    // Keep these entries
 		    bindings3.append( b );
 		    pixlist3.append( p );
 		}
 		p = pixlist.next();
 	    }
 	    pixlist = pixlist3;
 	    bindings = bindings3;
 	}
+	if ( bindings.isEmpty() )
+	    break;
     }
     
     // Add all bindings to the menu
     if ( !bindings.isEmpty() )
     {
 	popupMenu->insertSeparator();
 
 	char *str;

["kfmprops.cpp.diff" (TEXT/plain)]

--- kdebase/kfm/kfmprops.cpp.orig	Tue Nov  3 11:46:36 1998
+++ kdebase/kfm/kfmprops.cpp	Tue Nov  3 11:51:56 1998
@@ -1531,33 +1531,37 @@
     if ( iconStr.isEmpty() )
 	iconStr = KMimeType::getDefaultPixmap();
     if ( !mimeStr.isEmpty() )
 	mimeEdit->setText( mimeStr.data() );
     
     iconBox->setIcon( iconStr );
     
     // Get list of all applications
-    int index = -1;
-    int i = 0;
+    QStrList applist;
+    QString currApp;
+    appBox->insertItem( klocale->translate("<none>") );
     QListIterator<KMimeBind> it = KMimeBind::bindingIterator();
     for ( ; it.current() != 0L; ++it )
     {
-	if ( appStr.data() != 0L )
-	    if ( strcmp( it.current()->getProgram(), appStr.data() ) == 0 )
-		index = i;
+	currApp = it.current()->getProgram();
 
-	appBox->insertItem( it.current()->getProgram() );
-	i++;
+	// list every app only once
+	if ( applist.find( currApp ) == -1 ) { 
+	    appBox->insertItem( currApp );
+	    applist.append( currApp );
+	}
     }
-    appBox->insertItem( "" );
     
     // Set the default app
-    if ( index == -1 )
-	index = i;
+    int index = applist.find( appStr );
+    if ( index != -1 )
+ 	index++;
+    else
+	index = 0;
     appBox->setCurrentItem( index );
     
     connect( iconBox, SIGNAL( activated( int ) ), this, SLOT( slotIconChanged( int ) ) );
 }
 
 bool BindingPropsPage::supports( KURL *_kurl )
 {
     KURL u( _kurl->url() );
@@ -1621,18 +1625,22 @@
     if ( tmp.length() > 1 )
 	if ( tmp.right(1) != ";" )
 	    tmp += ";";
     config.writeEntry( "Patterns", tmp.data() );
     config.writeEntry( "Comment", commentEdit->text(), true, false, true );
     config.writeEntry( "MimeType", mimeEdit->text() );
     config.writeEntry( "Icon", iconBox->icon() );
 
-    if ( appBox->currentItem() != -1 )
-	config.writeEntry( "DefaultApp", appBox->text( appBox->currentItem() ) );
+    // item 0 in appBox is reserved for <none>
+    if ( appBox->currentItem() == 0 )
+	appStr = "";
+    else
+	appStr = appBox->text( appBox->currentItem() );
+    config.writeEntry( "DefaultApp", appStr );
 
     config.sync();
 
     KMimeType::clearAll();
     KMimeType::init();
     if ( KRootWidget::getKRootWidget() )
 	KRootWidget::getKRootWidget()->update();
 

["root.cpp.diff" (TEXT/plain)]

--- kdebase/kfm/root.cpp.orig	Tue Nov  3 00:12:58 1998
+++ kdebase/kfm/root.cpp	Tue Nov  3 10:33:07 1998
@@ -180,16 +180,19 @@
 	// Run the action 'txt' on every single file
 	KMimeBind::runBinding( s, txt );    
     }
     unselectAllIcons();
 }
 
 void KRootWidget::openPopupMenu( QStrList &_urls, const QPoint &_point )
 {
+	// please note that this code is strongly related to 
+	// kfmman.cpp: void KFMManager::openPopupMenu( ... )
+
   if ( _urls.count() == 0 ){
     unselectAllIcons();
     return;
   }
     
     char *s;
     for ( s = _urls.first(); s != 0L; s = _urls.next() )
     {
@@ -278,34 +281,40 @@
 	// If this is the first file in the list, assume that all bindings are ok
 	if ( s == _urls.getFirst() )
 	{
 	    KMimeType::getBindings( bindings, pixlist, s, isdir );
 	}
 	// Take only bindings, matching all files.
 	else
 	{
+	    bindings2.clear();
+	    pixlist2.clear();
 	    KMimeType::getBindings( bindings2, pixlist2, s, isdir );
 	    char *b;
 	    QPixmap *p = pixlist.first();
+	    bindings3.clear();
+	    pixlist3.clear();
 	    // Look thru all bindings we have so far
 	    for ( b = bindings.first(); b != 0L; b = bindings.next() )
 	    {
 		// Does the binding match this file, too ?
 		if ( bindings2.find( b ) != -1 )
 		{
 		    // Keep these entries
 		    bindings3.append( b );
 		    pixlist3.append( p );
 		}
 		p = pixlist.next();
 	    }
 	    pixlist = pixlist3;
 	    bindings = bindings3;
 	}
+	if( bindings.isEmpty() )
+	    break;
     }
     
     // Add all bindings to the menu
     if ( !bindings.isEmpty() )
     {
 	popupMenu->insertSeparator();
 
 	char *str;


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

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