Bug 184279 - If I load the text mimetype handler as ReadOnlyPart, it behaves like an editor
Summary: If I load the text mimetype handler as ReadOnlyPart, it behaves like an editor
Status: RESOLVED FIXED
Alias: None
Product: kde
Classification: I don't know
Component: general (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-14 09:47 UTC by Karai Csaba
Modified: 2020-09-28 23:41 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.