Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / apps / konqueror / sidebar / konqsidebar.cpp
blobfe853ba19bb9359be054d24d6c9477c39ee2f160
1 /***************************************************************************
2 konqsidebar.cpp
3 -------------------
4 begin : Sat June 2 16:25:27 CEST 2001
5 copyright : (C) 2001 Joseph Wenninger
6 email : jowenn@kde.org
7 ***************************************************************************/
9 /***************************************************************************
10 * *
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. *
15 * *
16 ***************************************************************************/
17 #include "konqsidebar.h"
18 #include "konqsidebariface_p.h"
20 #include <konq_events.h>
21 #include <kdebug.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());
30 m_extension = 0;
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);
40 setWidget(m_widget);
43 const KComponentData &KonqSidebar::getInstance()
45 kDebug();
46 return KonqSidebarFactory::componentData();
49 KonqSidebar::~KonqSidebar()
53 bool KonqSidebar::openFile()
55 return true;
58 bool KonqSidebar::openUrl(const KUrl &url) {
59 if (m_widget)
60 return m_widget->openUrl(url);
61 else return false;
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>
80 #include <klocale.h>
81 #include <kcomponentdata.h>
83 KComponentData *KonqSidebarFactory::s_instance = 0L;
84 KAboutData* KonqSidebarFactory::s_about = 0L;
86 KonqSidebarFactory::KonqSidebarFactory()
87 : KParts::Factory()
91 KonqSidebarFactory::~KonqSidebarFactory()
93 delete s_instance;
94 s_instance = 0L;
95 delete s_about;
96 s_about = 0L;
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);
109 return obj;
112 const KComponentData &KonqSidebarFactory::componentData()
114 if( !s_instance )
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);
120 return *s_instance;
123 K_EXPORT_COMPONENT_FACTORY( konq_sidebar, KonqSidebarFactory )
125 #include "konqsidebar.moc"