Bug 184279

Summary: If I load the text mimetype handler as ReadOnlyPart, it behaves like an editor
Product: [I don't know] kde Reporter: Karai Csaba <cskarai>
Component: generalAssignee: Unassigned bugs mailing-list <unassigned-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: nate
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Karai Csaba 2009-02-14 09:47:49 UTC
Version:            (using KDE 4.2.0)
OS:                Linux
Installed from:    SuSE RPMs

Hi, I'm a developer of the Krusader team.

If I try viewing a file in Krusader F3, the text editor part is loaded instead of the viewer. This used to work in KDE 4.1.x.

I think, that if I load the text part as ReadOnlyPart, then it shouldn't behave like an editor.

Thanks,

    Csaba


Code:

KParts::ReadOnlyPart* PanelViewer::getPart( QString mimetype ) {
	KParts::ReadOnlyPart * part = 0L;
	KPluginFactory *factory = 0;
	KService::Ptr ptr = KMimeTypeTrader::self()->preferredService( mimetype, "KParts/ReadOnlyPart" );
	if ( ptr ) {
		QStringList args;
		QVariant argsProp = ptr->property( "X-KDE-BrowserView-Args" );
		if ( argsProp.isValid() ) {
			QString argStr = argsProp.toString();
			args = argStr.split( " " );
		}
		QVariant prop = ptr->property( "X-KDE-BrowserView-AllowAsDefault" );
		if ( !prop.isValid() || prop.toBool() )   // defaults to true
		{
			factory = KLibLoader::self() ->factory( ptr->library().toLatin1() );
			if ( factory ) {
				if( ptr->serviceTypes().contains( "Browser/View" ) )
					part = static_cast<KParts::ReadOnlyPart *>( factory->create( this,
					        QString( "Browser/View" ).toLatin1(), args ) );
				if( !part )
					part = static_cast<KParts::ReadOnlyPart *>( factory->create( this,
					        QString( "KParts::ReadOnlyPart" ).toLatin1(), args ) );
			}
		}
	}
	if ( part ) {
		KParts::BrowserExtension * ext = KParts::BrowserExtension::childObject( part );
		if ( ext ) {
			connect( ext, SIGNAL( openUrlRequestDelayed( const KUrl &, const KParts::OpenUrlArguments&, const KParts::BrowserArguments& ) ), this, SLOT( openUrl( const KUrl & ) ) );
			connect( ext, SIGNAL( openUrlRequestDelayed( const KUrl &, const KParts::OpenUrlArguments&, const KParts::BrowserArguments& ) ), this, SIGNAL( openUrlRequest( const KUrl & ) ) );
		}
	}
	return part;
}
Comment 1 Karai Csaba 2009-02-18 10:54:04 UTC
Konqueror also loads the editor if I open a text file.
Comment 2 Andrew Crouthamel 2018-11-02 04:21:41 UTC
Dear Bug Submitter,

This bug has been stagnant for a long time. Could you help us out and re-test if the bug is valid in the latest version? I am setting the status to NEEDSINFO pending your response, please change the Status back to REPORTED when you respond.

Thank you for helping us make KDE software even better for everyone!
Comment 3 Andrew Crouthamel 2018-11-16 02:43:39 UTC
Dear Bug Submitter,

This is a reminder that this bug has been stagnant for a long time. Could you help us out and re-test if the bug is valid in the latest version?

Thank you for helping us make KDE software even better for everyone!
Comment 4 Nate Graham 2020-09-28 23:41:42 UTC
No response; assuming it was fixed since then.