1 /***************************************************************************
4 begin : Sat June 2 16:25:27 CEST 2001
5 copyright : (C) 2001 Joseph Wenninger
7 ***************************************************************************/
9 /***************************************************************************
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
16 ***************************************************************************/
17 #include "konqsidebar.h"
18 #include "konqsidebariface_p.h"
20 #include <konq_events.h>
22 #include <QtGui/QApplication>
23 #include <kacceleratormanager.h>
25 KonqSidebar::KonqSidebar( QWidget
*parentWidget
, QObject
*parent
, bool universalMode
)
26 : KParts::ReadOnlyPart(parent
),KonqSidebarIface()
28 // we need an instance
29 setComponentData(KonqSidebarFactory::componentData());
31 // this should be your custom internal widget
32 m_widget
= new Sidebar_Widget( parentWidget
, this, universalMode
, parentWidget
->window()->property("currentProfile").toString() );
33 m_extension
= new KonqSidebarBrowserExtension( this, m_widget
);
34 connect(m_widget
,SIGNAL(started(KIO::Job
*)),
35 this, SIGNAL(started(KIO::Job
*)));
36 connect(m_widget
,SIGNAL(completed()),this,SIGNAL(completed()));
37 connect(m_extension
, SIGNAL(addWebSideBar(const KUrl
&, const QString
&)),
38 m_widget
, SLOT(addWebSideBar(const KUrl
&, const QString
&)));
39 KAcceleratorManager::setNoAccel(m_widget
);
43 const KComponentData
&KonqSidebar::getInstance()
46 return KonqSidebarFactory::componentData();
49 KonqSidebar::~KonqSidebar()
53 bool KonqSidebar::openFile()
58 bool KonqSidebar::openUrl(const KUrl
&url
) {
60 return m_widget
->openUrl(url
);
64 void KonqSidebar::customEvent(QEvent
* ev
)
66 if (KonqFileSelectionEvent::test(ev
) ||
67 KonqFileMouseOverEvent::test(ev
) ||
68 KonqConfigEvent::test(ev
))
70 // Forward the event to the widget
71 QApplication::sendEvent( m_widget
, ev
);
77 // It's usually safe to leave the factory code alone.. with the
78 // notable exception of the KAboutData data
79 #include <kaboutdata.h>
81 #include <kcomponentdata.h>
83 KComponentData
*KonqSidebarFactory::s_instance
= 0L;
84 KAboutData
* KonqSidebarFactory::s_about
= 0L;
86 KonqSidebarFactory::KonqSidebarFactory()
91 KonqSidebarFactory::~KonqSidebarFactory()
99 KParts::Part
* KonqSidebarFactory::createPartObject( QWidget
*parentWidget
, QObject
*parent
,
100 const char * /*classname*/, const QStringList
&args
)
102 // Create an instance of our Part
103 KonqSidebar
* obj
= new KonqSidebar( parentWidget
, parent
, args
.contains("universal") );
105 // See if we are to be read-write or not
106 // if (QCString(classname) == "KParts::ReadOnlyPart")
107 // obj->setReadWrite(false);
112 const KComponentData
&KonqSidebarFactory::componentData()
116 s_about
= new KAboutData("konqsidebartng", 0, ki18n("Extended Sidebar"), "0.1");
117 s_about
->addAuthor(ki18n("Joseph WENNINGER"), KLocalizedString(), "jowenn@bigfoot.com");
118 s_instance
= new KComponentData(s_about
);
123 K_EXPORT_COMPONENT_FACTORY( konq_sidebar
, KonqSidebarFactory
)
125 #include "konqsidebar.moc"