[Bug 58912] File Open gives "Could not import file of type text/x-chdr"

Roger Larsson roger.larsson at norran.net
Tue Jun 17 02:10:06 UTC 2003


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
     
http://bugs.kde.org/show_bug.cgi?id=58912     




------- Additional Comments From roger.larsson at norran.net  2003-06-17 02:09 -------
Subject: Re:  File Open gives "Could not import file of type text/x-chdr"

> But I wonder if it is not the MIME type rewrite a few lines up that is the
> real cause?
> if (mimeType.startsWith("text/") 
>       || mimeType == "application/x-zerosize"
>       || mimeType == "application/x-desktop"
>       || mimeType == "application/x-kdevelop" 
>       || mimeType == "application/x-kdevelop-project"
>       || mimeType == "image/x-xpm" 
>       || mimeType == "application/x-perl")
>
>   {
>       mimeType = "text/plain";
>       kapp->config()->setGroup("Editor");
>       preferred = kapp->config()->readEntry("EmbeddedKTextEditor", "");
>   } else if( mimeType.startsWith("inode/") ){
>       return;
>   }

I tried a patch that removed the startsWith("text/") and it works much better.


But my feeling is that we get into trouble since the logical order is wrong.
Shouldn't it be more like this:

	if ( mimeType.startsWith("inode/") ) {
		return;
	}

	preferred = kapp->config()->readEntry("EmbeddedKTextEditor", "");

	if (preferred != "")
	{
		// Check all types that can be viewed as a text/* type
		if (mimeType.startsWith("text/") 
		      || mimeType == "application/x-zerosize"
		      || mimeType == "application/x-desktop"
		      || mimeType == "application/x-kdevelop"
		      || mimeType == "application/x-kdevelop-project"
		      || mimeType == "image/x-xpm" // edit as text???
		      || mimeType == "application/x-perl")
		 {
			mimeType = "text/plain";
			kapp->config()->setGroup("Editor");
		}
	}

But it might still give some unexpected error messages, but at least now
the EmbeddedTextEditor is defined...




More information about the KDevelop-devel mailing list