[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: Find out info about KParts
From: Christoffer Brodd-Reijer <ephracis () linux ! se>
Date: 2006-02-18 12:16:30
Message-ID: 43F7101E.9050208 () linux ! se
[Download RAW message or body]
Christoffer Brodd-Reijer wrote:
> David Faure wrote:
>> On Friday 17 February 2006 19:54, Christoffer Brodd-Reijer wrote:
>>> But as far as I understand it ktrader takes a mimetype and gives you a
>>> kpart to handle it. What if I want to use a filebrowser to show the
>>> contents in a certain directory? Does that work the same way?
>> Yes. The mimetype is inode/directory.
>>
>
> Great. I am having a great time using KParts, I am amazed over how great
> and usable they are.
>
> However, now when I have created two parts, of which one is a browser
> opening a local folder (I use KMimeType::findByURL() to get the
> mimetype), how can I find the api to whatever kpart is being used? For
> example I want to connect the two parts so that when an object in the
> browser is clicked the file (which should be an image) should be
> displayed in the other part.
>
> Or how can I manipulate the browser to make it view a tree view instead
> of icon view?
>
> Since I don't know which kpart is being used, I cannot just google on
> it. Or do all parts use the same api?
>
> Thanks.
>
I've found out that I need to use the browser extension to get the
openURLRequest and a few more nice stuff. But the problem is that I
don't know how to extend my currently read-only part with the browser
extension. Here is my code:
photoW::photoW(KParts::PartManager *manager, QWidget *parent, const char
*name) : QWidget(parent, name) {
QGridLayout *grid = new QGridLayout(this, 1, 1);
treePart = 0;
viewPart = 0;
splitter = new QSplitter(this);
KURL url("file:///media/psp/PSP/photo");
QString mimetype = KMimeType::findByURL(url)->name();
treePart =
KParts::ComponentFactory::createPartInstanceFromQuery<KParts::ReadOnlyPart>
(mimetype, QString::null, splitter, 0L, this, 0L);
viewPart =
KParts::ComponentFactory::createPartInstanceFromQuery<KParts::ReadOnlyPart>
(mimetype, QString::null, splitter, 0L, this, 0L);
treePart->widget()->show();
viewPart->widget()->show();
manager->addPart(treePart, TRUE);
manager->addPart(viewPart, FALSE);
treePart->openURL(url);
//connect(treePart->browserExtension(), SIGNAL(openURLRequest(KURL &)),
this, SLOT(openURL(KURL &)));
grid->addWidget(splitter, 0, 0);
}
But, I still don't know how to force the kpart treeView to display the
folder as a tree, instead of using an icon view.
Thanks,
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic