Version: 3.0.0a4 (using KDE 3.1.9) Compiler: gcc version 3.2 OS: Linux (i686) release 2.4.19-4GB Run into something strange. When I try to open files with kdevelop (gideon) it complains "Could not import file of type text/x-chdr" I am sure that it has something to do with configuration since it works on another user account (same computer and build). So I have tried to remove files and restart - no help. From what config file does the import settings come?
Sorry to be blunt, but this is a bug tracking system, not a help center. I'm closing this bug report. Please use the mailing lists and help forums for this. Try verifying the association between the MIME type.
Created attachment 1656 [details] stdout while opening a .cpp file This is what happens when I try to open a .cpp file in gideon. (Koffice?) Everything works if I click on the same file from konqueror, even the preview in gideon works. And everything works on another user... OK, I leave it as RESOLVED / INVALID for now...
Tracked this down a little. kdevelop/src/partcontroller.cpp editDocument() line:236 // load the appropriate part factory like chosen in the editor-chooser part // (Note: KTextEditor/Document is the editor in MDI mode. KTextEditor/Editor is the editor in SDI mode. // But KTextEditor/Editor doesn't work for the Kate part on KDE-3.0.x, so better use KTextEditor/Document anyway.) QString services[] = {"KTextEditor/Document", "KParts/ReadWritePart", "KParts/ReadOnlyPart"}; QString classnames[] = {"KTextEditor::Document", "KParts::ReadWritePart", "KParts::ReadOnlyPart"}; for (uint i=0; i<3; ++i) { factory = findPartFactory(mimeType, services[i], preferred); if (factory) { className = classnames[i]; break; } } I exit from this function with i=2, "KParts/ReadOnlyPart", "KParts::ReadOnlyPart"! when everything works it exits with i=0, "KTextEditor/Document", "KTextEditor::Document" and "KTextEditor::Document" gets modified into "KTextEditor::Editor" When opening the corresponding part KateDocument is used, but for me koffice will be the matching plugin - koffice! (koffice can't import filter text/x-chdr...) So findPartFactory() is suspected... I have again tried to remove files to no avail... more later... 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; } It gets translated into text/plain before editor opens - I might have something wrong there - in that case the debug messages are all wrong since the part is opened without this MIME type info => reopen!
That was the cause! Changed the association for "text/plain" embedded from 1) KHTML 2) kword To 1) KHTML 2) Embedded advanced textedit (retranslated from Swedish)
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...
This is related to: http://bugs.kde.org/show_bug.cgi?id=60038
I'm convinced our mimetype handling need improving in 3.1.. Raising priority.
I hope KDevelop HEAD can be said to handle this in a sane way now. Every mimetype KDE has registered as "isAlso" text/plain should be opened by KDevelop, and unknown mimetypes will produce a question to the user what to do with the file in question, with the option to open as plain text. Closing.
Looked at sources and found one possible problem (have not been able to try it since kdevelop currently do not compile for me) Suppose I have a specific source type that I want to open in a specific editor pluggin. Will this be possible? I think not since the source will be text/plain and that is checked before specifics... (I will try to remember to test this once I get kdevelop through compilation)
>"Suppose I have a specific source type that I want to open in a specific editor pluggin." Could you explain what you mean here? Is this theory or any actual existing case? Btw, welcome to #kdevelop on irc.freenode.net :)