[Bug 184279] New: If I load the text mimetype handler as ReadOnlyPart, it behaves like an editor

Karai Csaba cskarai at freemail.hu
Sat Feb 14 08:47:50 GMT 2009


http://bugs.kde.org/show_bug.cgi?id=184279

           Summary: If I load the text mimetype handler as ReadOnlyPart, it
                    behaves like an editor
           Product: kde
           Version: unspecified
          Platform: SuSE RPMs
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: general
        AssignedTo: unassigned-bugs at kde.org
        ReportedBy: cskarai at freemail.hu


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;
}


-- 
Configure bugmail: http://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the Unassigned-bugs mailing list