Port to KLibLoader and friends

svn path=/trunk/kdebase/konqueror/; revision=31238
This commit is contained in:
Torben Weis 1999-10-19 16:45:52 +00:00
parent 58cac59311
commit 260103c6ac
8 changed files with 82 additions and 86 deletions

View file

@ -1,5 +1,5 @@
INCLUDES = -I$(srcdir)/../libkonq $(all_includes)
INCLUDES = -I$(srcdir)/../libkonq $(all_includes) $(MICO_INCLUDES)
SUBDIRS = plugins
@ -18,9 +18,9 @@ libkonqueror_la_SOURCES = konq_mainview.cc konq_part.cc konq_shell.cc \
libkonqueror_la_METASOURCES = AUTO
libkonqueror_la_LDFLAGS = $(all_libraries) -version-info 1:0:0
libkonqueror_la_LDFLAGS = $(all_libraries) $(MICO_LDFLAGS) -version-info 1:0:0
libkonqueror_la_LIBADD = -lkparts ../libkonq/libkonq.la $(LIB_KIO) $(LIB_KDEUI) $(LIB_QT) $(LIB_KHTML)
libkonqueror_la_LIBADD = -lkparts ../libkonq/libkonq.la $(LIB_KIO) $(LIB_KDEUI) $(LIB_QT) $(LIB_KHTML) $(LIBMICO)
browser.moc.cc: $(kde_includes)/browser.h
$(MOC) $(kde_includes)/browser.h -o $(top_builddir)/konqueror/browser.moc.cc
@ -29,7 +29,7 @@ bin_PROGRAMS = konqueror
konqueror_SOURCES = konq_main.cc
konqueror_LDFLAGS = $(KDE_RPATH) $(all_libraries)
konqueror_LDFLAGS = $(KDE_RPATH) $(MICO_LDFLAGS) $(all_libraries)
konqueror_LDADD = libkonqueror.la -lkded
konqueror_LDADD = libkonqueror.la -lkded

View file

@ -48,7 +48,7 @@ extern "C"
KonqFactory::KonqFactory()
{
s_global = 0L;
QString path = global()->dirs()->saveLocation("data", "kfm/bookmarks", true);
QString path = global()->dirs()->saveLocation("data", "kfm/bookmarks", true);
(void)new KonqBookmarkManager( path );
(void)new KTraderServiceProvider;
(void)new KonqFileManager;
@ -101,9 +101,7 @@ BrowserView *KonqFactory::createView( const QString &serviceType,
//activate the view plugin
KService::Ptr service = offers.first();
Factory *factory = Loader::self()->factory( service->library(), service->libraryMajor(),
service->libraryMinor(),
service->libraryDependencies() );
KLibFactory *factory = KLibLoader::self()->factory( service->library() );
if ( !factory )
return 0L;
@ -113,18 +111,18 @@ BrowserView *KonqFactory::createView( const QString &serviceType,
return (BrowserView *)factory->create();
}
QObject* KonqFactory::create( QObject* parent = 0, const char* name = 0 )
QObject* KonqFactory::create( QObject* parent, const char* name, const char* classname )
{
// if ( !parent || !parent->inherits( "Part" ) )
// return 0L;
return new KonqPart( (Part *)parent, name );
return new KonqPart( parent, name );
}
KLibGlobal *KonqFactory::global()
{
if ( !s_global )
s_global = new KLibGlobal( "konqueror" );
return s_global;
}

View file

@ -2,22 +2,22 @@
Copyright (C) 1999 Simon Hausmann <hausmann@kde.org>
Copyright (C) 1999 David Faure <faure@kde.org>
Copyright (C) 1999 Torben Weis <weis@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
*/
#ifndef __konq_factory_h__
#define __konq_factory_h__ $Id$
@ -28,25 +28,24 @@
#include "konq_defs.h"
#include <klibglobal.h>
#include <loader.h>
#include <klibloader.h>
class BrowserView;
class KLibGlobal;
class KonqFactory : public Factory
class KonqFactory : public KLibFactory
{
Q_OBJECT
public:
KonqFactory();
static BrowserView *createView( const QString &serviceType,
QStringList &serviceTypes,
static BrowserView *createView( const QString &serviceType,
QStringList &serviceTypes,
Konqueror::DirectoryDisplayMode dirMode = Konqueror::LargeIcons );
virtual QObject* create( QObject* parent = 0, const char* name = 0 );
virtual QObject* create( QObject* parent = 0, const char* name = 0, const char* classname = "QObject" );
static KLibGlobal *global();
static KLibGlobal *global();
private:
static KLibGlobal *s_global;

View file

@ -65,7 +65,7 @@
#include <kservices.h>
#include <kpixmapcache.h>
#include <loader.h>
#include <klibloader.h>
#include <part.h>
#include <iostream.h>
@ -495,7 +495,7 @@ void KonqMainView::slotStarted()
(*it)->setLoading( true );
(*it)->makeHistory( true );
if ( m_currentView == *it )
{
startAnimation();
@ -659,9 +659,9 @@ void KonqMainView::customEvent( QCustomEvent *event )
if ( KonqURLEnterEvent::test( event ) )
{
QString url = ((KonqURLEnterEvent *)event)->url();
openURL( 0L, url );
m_paURLCombo->setCurrentItem( 0 );
m_paURLCombo->changeItem( url, 0 );
return;
@ -894,18 +894,18 @@ void KonqMainView::slotAbout()
void KonqMainView::slotUpAboutToShow()
{
QPopupMenu *popup = m_paUp->popupMenu();
popup->clear();
KURL u( m_currentView->view()->url() );
u.cd( ".." );
while ( u.hasPath() )
{
popup->insertItem( u.decodedURL() );
if ( u.path() == "/" )
break;
u.cd( ".." );
}
}
@ -938,7 +938,7 @@ void KonqMainView::slotForwardActivated( int id )
void KonqMainView::fillHistoryPopup( QPopupMenu *menu, const QStringList &urls )
{
menu->clear();
QStringList::ConstIterator it = urls.begin();
QStringList::ConstIterator end = urls.end();
for (; it != end; ++it )
@ -947,17 +947,17 @@ void KonqMainView::fillHistoryPopup( QPopupMenu *menu, const QStringList &urls )
menu->insertItem( *KPixmapCache::pixmapForURL( u, 0, u.isLocalFile(), true ),
*it );
}
}
void KonqMainView::setLocationBarURL( KonqChildView *childView, const QString &url )
{
childView->setLocationBarURL( url );
if ( childView == m_currentView )
m_paURLCombo->changeItem( url, 0 );
}
void KonqMainView::viewActivateEvent( ViewActivateEvent *e )
@ -1062,27 +1062,27 @@ void KonqMainView::initActions()
popup->insertSeparator();
m_paUp = new KActionMenu( i18n( "&Up" ), QIconSet( BarIcon( "up", KonqFactory::global() ) ), actionCollection(), "up" );
connect( m_paUp, SIGNAL( activated() ), this, SLOT( slotUp() ) );
connect( m_paUp->popupMenu(), SIGNAL( aboutToShow() ), this, SLOT( slotUpAboutToShow() ) );
connect( m_paUp->popupMenu(), SIGNAL( activated( int ) ), this, SLOT( slotUpActivated( int ) ) );
m_paBack = new KActionMenu( i18n( "&Back" ), QIconSet( BarIcon( "back", KonqFactory::global() ) ), actionCollection(), "back" );
m_paBack->setEnabled( false );
connect( m_paBack, SIGNAL( activated() ), this, SLOT( slotBack() ) );
connect( m_paBack->popupMenu(), SIGNAL( aboutToShow() ), this, SLOT( slotBackAboutToShow() ) );
connect( m_paBack->popupMenu(), SIGNAL( activated( int ) ), this, SLOT( slotBackActivated( int ) ) );
m_paForward = new KActionMenu( i18n( "&Forward" ), QIconSet( BarIcon( "forward", KonqFactory::global() ) ), actionCollection(), "forward" );
m_paForward->setEnabled( false );
connect( m_paForward, SIGNAL( activated() ), this, SLOT( slotForward() ) );
connect( m_paForward->popupMenu(), SIGNAL( aboutToShow() ), this, SLOT( slotForwardAboutToShow() ) );
connect( m_paForward->popupMenu(), SIGNAL( activated( int ) ), this, SLOT( slotForwardActivated( int ) ) );
m_paHome = new KAction( i18n("&Home" ), QIconSet( BarIcon( "home", KonqFactory::global() ) ), 0, this, SLOT( slotHome() ), actionCollection(), "home" );
m_paCache = new KAction( i18n( "&Cache" ), 0, this, SLOT( slotShowCache() ), actionCollection(), "cache" );
@ -1156,18 +1156,17 @@ void KonqMainView::initPlugins()
KTrader::OfferList offers = KdedInstance::self()->ktrader()->query( "Konqueror/Plugin" );
KTrader::OfferList::ConstIterator it = offers.begin();
KTrader::OfferList::ConstIterator end = offers.end();
for (; it != end; ++it )
{
if ( (*it)->library().isEmpty() )
continue;
Factory *factory = Loader::self()->factory( (*it)->library(), (*it)->libraryMajor(), (*it)->libraryMinor(),
(*it)->libraryDependencies() );
KLibFactory *factory = KLibLoader::self()->factory( (*it)->library() );
if ( !factory )
continue;
(void)factory->create( this );
}
}
@ -1234,7 +1233,7 @@ void KonqMainView::updateStatusBar()
m_progressBar->setValue( progress );
m_statusBar->changeItem( 0L, STATUSBAR_SPEED_ID );
m_statusBar->changeItem( 0L, STATUSBAR_MSG_ID );
}

View file

@ -26,7 +26,7 @@
#include <kstddirs.h>
KonqPart::KonqPart( Part *parent, const char *name )
KonqPart::KonqPart( QObject *parent, const char *name )
: Part( parent, name )
{
m_bOpenInitialURL = true;
@ -39,10 +39,10 @@ KonqPart::~KonqPart()
View *KonqPart::createView( QWidget *parent, const char *name )
{
KonqMainView *view = new KonqMainView( this, parent, name ? name : "KonqMainView" );
if ( m_bOpenInitialURL )
view->openURL( 0L, QDir::homeDirPath().prepend( "file:" ) );
return view;
}

View file

@ -26,22 +26,22 @@ class KonqPart : public Part
{
Q_OBJECT
public:
KonqPart( Part *parent = 0, const char *name = 0 );
KonqPart( QObject *parent = 0, const char *name = 0 );
~KonqPart();
void setOpenInitialURL( bool open ) { m_bOpenInitialURL = open; }
virtual View *createView( QWidget *parent = 0, const char *name = 0 );
virtual Shell *createShell();
virtual void paintEverything( QPainter &painter, const QRect &rect,
bool transparent = false, View *view = 0 );
protected:
virtual QString configFile() const;
private:
bool m_bOpenInitialURL;
bool m_bOpenInitialURL;
};
#endif

View file

@ -1,21 +1,21 @@
/* This file is part of the KDE project
Copyright (C) 1999 Simon Hausmann <hausmann@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
*/
#include "main.h"
#include "configwidget.h"
@ -47,21 +47,21 @@ KonqSearcher::~KonqSearcher()
bool KonqSearcher::eventFilter( QObject *obj, QEvent *ev )
{
if ( KonqURLEnterEvent::test( ev ) )
{
QString url = ((KonqURLEnterEvent *)ev)->url();
cerr << "filtering " << url.ascii() << endl;
KURL kurl( url );
// candidate?
if ( kurl.isMalformed() || !KProtocolManager::self().protocols().contains( kurl.protocol() ) )
{
int pos = url.find( ':' );
QString key = url.left( pos );
QString query = EngineCfg::self()->query( key );
if ( query != QString::null )
{
@ -81,7 +81,7 @@ bool KonqSearcher::eventFilter( QObject *obj, QEvent *ev )
}
KonqSearcherFactory::KonqSearcherFactory( QObject *parent = 0, const char *name )
: Factory( parent, name )
: KLibFactory( parent, name )
{
s_global = new KLibGlobal( "konq_searcher" );
}
@ -90,7 +90,7 @@ KonqSearcherFactory::~KonqSearcherFactory()
{
}
QObject *KonqSearcherFactory::create( QObject *parent, const char *name )
QObject *KonqSearcherFactory::create( QObject *parent, const char *name, const char* classname )
{
return new KonqSearcher( parent );
}
@ -116,7 +116,7 @@ int main( int argc, char **argv )
KOMAutoLoader<KonqSearcherFactory> pluginLoader( "IDL:KOM/PluginFactory:1.0", "KonqSearcher" );
ConfigWidget *w = new ConfigWidget;
if ( !QXEmbed::processClientCmdline( w, argc, argv ) )
delete w;
@ -124,4 +124,4 @@ int main( int argc, char **argv )
return 0;
}
*/
#include "main.moc"
#include "main.moc"

View file

@ -1,26 +1,26 @@
/* This file is part of the KDE project
Copyright (C) 1999 Simon Hausmann <hausmann@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
*/
#ifndef __main_h__
#define __main_h__ $Id$
#include <loader.h>
#include <klibloader.h>
class KLibGlobal;
class KonqMainView;
@ -31,22 +31,22 @@ class KonqSearcher : public QObject
public:
KonqSearcher( QObject *parent );
~KonqSearcher();
protected:
protected:
bool eventFilter( QObject *obj, QEvent *ev );
};
class KonqSearcherFactory : public Factory
class KonqSearcherFactory : public KLibFactory
{
Q_OBJECT
public:
KonqSearcherFactory( QObject *parent = 0, const char *name = 0 );
~KonqSearcherFactory();
virtual QObject *create( QObject *parent = 0, const char *name = 0 );
virtual QObject *create( QObject *parent = 0, const char *name = 0, const char* classname = "QObject" );
static KLibGlobal *global();
private:
static KLibGlobal *s_global;
};