merge the kinstance-redesign branch back to trunk.

svn path=/trunk/KDE/kdebase/konqueror/; revision=628276
This commit is contained in:
Matthias Kretz 2007-01-29 17:14:20 +00:00
parent f77b634df6
commit 979dfb806a
91 changed files with 264 additions and 264 deletions

View file

@ -59,7 +59,7 @@ typedef KGenericFactory<KCMUserAccount, QWidget> Factory;
K_EXPORT_COMPONENT_FACTORY( useraccount, Factory("useraccount") )
KCMUserAccount::KCMUserAccount( QWidget *parent, const QStringList &)
: KCModule( Factory::instance(), parent)
: KCModule( Factory::componentData(), parent)
{
QVBoxLayout *topLayout = new QVBoxLayout(this);
_mw = new MainWidget(this);

View file

@ -87,7 +87,7 @@ static bool askUser(QString filename, bool &readonly) {
int ret = KMessageBox::warningYesNo(0,
i18n("Another instance of %1 is already running, do you really "
"want to open another instance or continue work in the same instance?\n"
"Please note that, unfortunately, duplicate views are read-only.", kapp->caption()),
"Please note that, unfortunately, duplicate views are read-only.", KGlobal::caption()),
i18n("Warning"),
KGuiItem(i18n("Run Another")), /* yes */
KGuiItem(i18n("Continue in Same")) /* no */);

View file

@ -487,7 +487,7 @@ void KEBApp::notifyCommandExecuted() {
/* -------------------------- */
void KEBApp::slotConfigureToolbars() {
saveMainWindowSettings(KGlobal::config(), "MainWindow");
saveMainWindowSettings(KGlobal::config().data(), "MainWindow");
KEditToolbar dlg(actionCollection());
connect(&dlg, SIGNAL( newToolbarConfig() ),
SLOT( slotNewToolbarConfig() ));
@ -497,7 +497,7 @@ void KEBApp::slotConfigureToolbars() {
void KEBApp::slotNewToolbarConfig() {
// called when OK or Apply is clicked
createGUI();
applyMainWindowSettings(KGlobal::config(), "MainWindow");
applyMainWindowSettings(KGlobal::config().data(), "MainWindow");
}
/* -------------------------- */

View file

@ -26,7 +26,7 @@
#include <klocale.h>
#include <kfileitem.h>
#include <kdirlister.h>
#include <kinstance.h>
#include <kcomponentdata.h>
#include <QDir>
@ -38,7 +38,7 @@ K_EXPORT_COMPONENT_FACTORY( libkfindpart, KFindFactory )
KFindPart::KFindPart( QWidget * parentWidget, QObject *parent, const QStringList & /*args*/ )
: KonqDirPart (parent)/*KParts::ReadOnlyPart*/
{
setInstance( KFindFactory::instance() );
setComponentData( KFindFactory::componentData() );
setBrowserExtension( new KonqDirPartBrowserExtension( this ) );

View file

@ -415,7 +415,7 @@ KfindTabWidget::~KfindTabWidget()
void KfindTabWidget::setURL( const KUrl & url )
{
KConfig *conf = KGlobal::config();
KSharedConfig::Ptr conf = KGlobal::config();
conf->setGroup("History");
m_url = url;
QStringList sl = conf->readPathListEntry("Directories");
@ -488,7 +488,7 @@ void KfindTabWidget::saveHistory()
void KfindTabWidget::loadHistory()
{
// Load pattern history
KConfig *conf = KGlobal::config();
KSharedConfig::Ptr conf = KGlobal::config();
conf->setGroup("History");
QStringList sl = conf->readEntry("Patterns", QStringList());
if(!sl.isEmpty())
@ -882,7 +882,7 @@ static void save_pattern(QComboBox *obj,
}
}
KConfig *conf = KGlobal::config();
KSharedConfig::Ptr conf = KGlobal::config();
conf->setGroup(group);
conf->writePathEntry(entry, sl);
}

View file

@ -22,7 +22,7 @@
K_EXPORT_COMPONENT_FACTORY( konq_aboutpage, KonqAboutPageFactory )
KInstance *KonqAboutPageFactory::s_instance = 0;
KComponentData *KonqAboutPageFactory::s_instance = 0;
QString *KonqAboutPageFactory::s_launch_html = 0;
QString *KonqAboutPageFactory::s_intro_html = 0;
QString *KonqAboutPageFactory::s_specs_html = 0;
@ -32,7 +32,7 @@ QString *KonqAboutPageFactory::s_plugins_html = 0;
KonqAboutPageFactory::KonqAboutPageFactory( QObject *parent )
: KParts::Factory( parent )
{
s_instance = new KInstance( "konqaboutpage" );
s_instance = new KComponentData("konqaboutpage");
}
KonqAboutPageFactory::~KonqAboutPageFactory()

View file

@ -5,7 +5,7 @@
#include <khtml_part.h>
class KHTMLPart;
class KInstance;
class KComponentData;
class KonqAboutPageFactory : public KParts::Factory
{
@ -16,7 +16,7 @@ public:
virtual KParts::Part *createPartObject( QWidget *parentWidget, QObject *parent,
const char *classname, const QStringList &args );
static KInstance *instance() { return s_instance; }
static const KComponentData &componentData() { return *s_instance; }
static QString launch();
static QString intro();
@ -27,7 +27,7 @@ public:
private:
static QString loadFile( const QString& file );
static KInstance *s_instance;
static KComponentData *s_instance;
static QString *s_launch_html, *s_intro_html, *s_specs_html, *s_tips_html, *s_plugins_html;
};

View file

@ -32,7 +32,7 @@
#include <kdebug.h>
#include <kservice.h>
#include <krun.h>
#include <kinstance.h>
#include <kcomponentdata.h>
#include <kstaticdeleter.h>
#include <konq_mainwindow_interface.h>
@ -60,8 +60,7 @@ QByteArray ClientApp::startup_id_str;
bool ClientApp::m_ok = true;
bool s_interactive = true;
static KInstance* s_instance = 0;
static KStaticDeleter<KInstance> s_instanceSd;
K_GLOBAL_STATIC(KComponentData, s_instance);
static const KCmdLineOptions options[] =
{
@ -112,9 +111,8 @@ extern "C" KDE_EXPORT int kdemain( int argc, char **argv )
// Call needInstance before any use of KConfig
static void needInstance()
{
if ( !s_instance ) {
s_instanceSd.setObject( s_instance, new KInstance( appName ) );
}
KComponentData *tmp = s_instance; // inits the global static if referenced for the first time
Q_UNUSED(tmp);
}
/*

View file

@ -42,7 +42,7 @@ KonqPart::KonqPart( QWidget* parentWidget, QObject* parent, const QStringList& a
,m_fileTip( new KonqFileTip( 0 /* m_view*/ ) )
{
KonqFMSettings* settings = KonqFMSettings::settings();
setInstance( KonqFactory::instance() );
setComponentData( KonqFactory::componentData() );
setBrowserExtension( new KonqDirPartBrowserExtension( this ) );
setDirLister( m_model->dirLister() );

View file

@ -82,27 +82,27 @@ public:
return obj;
}
static KInstance *instance()
static const KComponentData &componentData()
{
if ( !s_instance )
s_instance = new KInstance( "konqiconview" );
return s_instance;
s_instance = new KComponentData("konqiconview");
return *s_instance;
}
static KonqPropsView *defaultViewProps()
{
if ( !s_defaultViewProps )
s_defaultViewProps = new KonqPropsView( instance(), 0L );
s_defaultViewProps = new KonqPropsView( componentData(), 0L );
return s_defaultViewProps;
}
private:
static KInstance *s_instance;
static KComponentData *s_instance;
static KonqPropsView *s_defaultViewProps;
};
KInstance *KonqIconViewFactory::s_instance = 0;
KComponentData *KonqIconViewFactory::s_instance = 0;
KonqPropsView *KonqIconViewFactory::s_defaultViewProps = 0;
@ -177,7 +177,7 @@ KonqKfmIconView::KonqKfmIconView( QWidget *parentWidget, QObject *parent, const
setBrowserExtension( new IconViewBrowserExtension( this ) );
// Create a properties instance for this view
m_pProps = new KonqPropsView( KonqIconViewFactory::instance(), KonqIconViewFactory::defaultViewProps() );
m_pProps = new KonqPropsView( KonqIconViewFactory::componentData(), KonqIconViewFactory::defaultViewProps() );
m_pIconView = new KonqIconViewWidget( parentWidget );
m_pIconView->initConfig( true );
@ -202,7 +202,7 @@ KonqKfmIconView::KonqKfmIconView( QWidget *parentWidget, QObject *parent, const
setWidget( m_pIconView );
m_mimeTypeResolver = new K3MimeTypeResolver<KFileIVI,KonqKfmIconView>(this);
setInstance( KonqIconViewFactory::instance() );
setComponentData( KonqIconViewFactory::componentData() );
setXMLFile( "konq_iconview.rc" );

View file

@ -38,6 +38,7 @@
#include "konq_view.h"
#include "konq_combo.h"
#include <kconfiggroup.h>
KConfig * KonqCombo::s_config = 0L;
const int KonqCombo::temporary = 0;

View file

@ -22,7 +22,7 @@
#include <kconfig.h>
#include <kdebug.h>
#include <klocale.h>
#include <kinstance.h>
#include <kcomponentdata.h>
#include <kparts/componentfactory.h>
#include <kparts/plugin.h>
#include <kplugininfo.h>
@ -78,9 +78,9 @@ KonqExtensionManager::KonqExtensionManager(QWidget *parent, KonqMainWindow *main
// have their config in the same KConfig[Group]. So we can't show konqueror extensions and khtml extensions in the same tab.
d->pluginSelector->addPlugins("konqueror", i18n("Extensions"), "Extensions", KGlobal::config());
if ( activePart ) {
KInstance* instance = activePart->instance();
d->pluginSelector->addPlugins(instance->instanceName(), i18n("Tools"), "Tools", instance->config());
d->pluginSelector->addPlugins(instance->instanceName(), i18n("Statusbar"), "Statusbar", instance->config());
KComponentData componentData = activePart->componentData();
d->pluginSelector->addPlugins(componentData.componentName(), i18n("Tools"), "Tools", componentData.config());
d->pluginSelector->addPlugins(componentData.componentName(), i18n("Statusbar"), "Statusbar", componentData.config());
}
connect( this, SIGNAL( okClicked() ), SLOT( slotOk() ) );
@ -108,7 +108,7 @@ void KonqExtensionManager::apply()
setChanged(false);
if( d->mainWindow )
{
KParts::Plugin::loadPlugins(d->mainWindow, d->mainWindow, KGlobal::instance());
KParts::Plugin::loadPlugins(d->mainWindow, d->mainWindow, KGlobal::mainComponent());
QList<KParts::Plugin*> plugins = KParts::Plugin::pluginObjects(d->mainWindow);
for (int i = 0; i < plugins.size(); ++i) {
d->mainWindow->factory()->addClient(plugins.at(i));
@ -116,7 +116,7 @@ void KonqExtensionManager::apply()
}
if ( d->activePart )
{
KParts::Plugin::loadPlugins( d->activePart, d->activePart, d->activePart->instance() );
KParts::Plugin::loadPlugins( d->activePart, d->activePart, d->activePart->componentData() );
QList<KParts::Plugin*> plugins = KParts::Plugin::pluginObjects( d->activePart );
for (int i = 0; i < plugins.size(); ++i) {
d->activePart->factory()->addClient(plugins.at(i));

View file

@ -36,8 +36,8 @@ PopupMenuGUIClient::PopupMenuGUIClient( KonqMainWindow *mainWindow,
bool showEmbeddingServices, bool doTabHandling )
{
//giving a name to each guiclient: just for debugging
// (needs delete instance() in the dtor if enabled for good)
//setInstance( new KInstance( "PopupMenuGUIClient" ) );
// (needs delete componentData() in the dtor if enabled for good)
//setComponentData( KComponentData( "PopupMenuGUIClient" ) );
m_mainWindow = mainWindow;

View file

@ -137,6 +137,7 @@
#include <kstaticdeleter.h>
#include "konq_mainwindow_p.h"
#include <QtDBus/QtDBus>
#include <kconfiggroup.h>
template class QList<QPixmap*>;
template class QList<KToggleAction*>;
@ -237,7 +238,7 @@ KonqMainWindow::KonqMainWindow( const KUrl &initialURL, bool openInitialURL, con
initCombo();
initActions();
setInstance( KGlobal::instance() );
setComponentData( KGlobal::mainComponent() );
connect( KSycoca::self(), SIGNAL( databaseChanged() ),
this, SLOT( slotDatabaseChanged() ) );
@ -1945,7 +1946,7 @@ void KonqMainWindow::slotConfigureSpellChecking()
void KonqMainWindow::slotConfigureToolbars()
{
if ( autoSaveSettings() )
saveMainWindowSettings( KGlobal::config(), "KonqMainWindow" );
saveMainWindowSettings( KGlobal::config().data(), "KonqMainWindow" );
KEditToolbar dlg(factory());
connect(&dlg,SIGNAL(newToolbarConfig()),this,SLOT(slotNewToolbarConfig()));
connect(&dlg,SIGNAL(newToolbarConfig()),this,SLOT(initBookmarkBar()));
@ -1961,7 +1962,7 @@ void KonqMainWindow::slotNewToolbarConfig() // This is called when OK or Apply i
plugViewModeActions();
applyMainWindowSettings( KGlobal::config(), "KonqMainWindow" );
applyMainWindowSettings( KGlobal::config().data(), "KonqMainWindow" );
}
void KonqMainWindow::slotUndoAvailable( bool avail )
@ -2105,7 +2106,7 @@ void KonqMainWindow::slotViewCompleted( KonqView * view )
void KonqMainWindow::slotPartActivated( KParts::Part *part )
{
kDebug(1202) << "KonqMainWindow::slotPartActivated " << part << " "
<< ( part && part->instance() && part->instance()->aboutData() ? part->instance()->aboutData()->appName() : "" ) << endl;
<< ( part && part->componentData().isValid() && part->componentData().aboutData() ? part->componentData().aboutData()->appName() : "" ) << endl;
KonqView *newView = 0;
KonqView *oldView = m_currentView;
@ -2235,7 +2236,7 @@ void KonqMainWindow::slotPartActivated( KParts::Part *part )
updateToolBarActions();
m_currentView->setActiveInstance();
m_currentView->setActiveComponent();
}
void KonqMainWindow::insertChildView( KonqView *childView )
@ -3462,7 +3463,7 @@ void KonqMainWindow::slotForceSaveMainWindowSettings()
// kDebug(1202)<<"slotForceSaveMainWindowSettings()"<<endl;
if ( autoSaveSettings() ) // don't do it on e.g. JS window.open windows with no toolbars!
{
saveMainWindowSettings( KGlobal::config(), "KonqMainWindow" );
saveMainWindowSettings( KGlobal::config().data(), "KonqMainWindow" );
KGlobal::config()->sync();
}
}
@ -4534,7 +4535,7 @@ void KonqMainWindow::setCaption( const QString &caption )
{
kDebug(1202) << "KonqMainWindow::setCaption(" << caption << ")" << endl;
// Keep an unmodified copy of the caption (before KInstance::makeStdCaption is applied)
// Keep an unmodified copy of the caption (before KComponentData::makeStdCaption is applied)
m_currentView->setCaption( caption );
KParts::MainWindow::setCaption( m_currentView->caption() );
}
@ -5108,7 +5109,7 @@ void KonqMainWindow::updateViewModeActions()
// Another temporary map, the preferred service for each library (2 entries in our example)
QMap<QString,QString> preferredServiceMap;
KConfig * config = KGlobal::config();
KSharedConfig::Ptr config = KGlobal::config();
KConfigGroup barServicesGroup( config, "ModeToolBarServices" );
KService::List::ConstIterator it = services.begin();
@ -5241,7 +5242,7 @@ void KonqMainWindow::saveToolBarServicesMap()
{
QMap<QString,KService::Ptr>::ConstIterator serviceIt = m_viewModeToolBarServices.begin();
QMap<QString,KService::Ptr>::ConstIterator serviceEnd = m_viewModeToolBarServices.end();
KConfig * config = KGlobal::config();
KSharedConfig::Ptr config = KGlobal::config();
KConfigGroup barServicesGroup( config, "ModeToolBarServices" );
for ( ; serviceIt != serviceEnd ; ++serviceIt )
barServicesGroup.writeEntry( serviceIt.key(), serviceIt.value()->desktopEntryName() );
@ -5288,7 +5289,7 @@ void KonqMainWindow::closeEvent( QCloseEvent *e )
KonqFrameTabs* tabContainer = static_cast<KonqFrameTabs*>(viewManager()->docContainer());
if ( tabContainer->count() > 1 )
{
KConfig *config = KGlobal::config();
KSharedConfig::Ptr config = KGlobal::config();
KConfigGroup cs( config, QLatin1String("Notification Messages") );
if ( !config->hasKey( "MultipleTabConfirm" ) )
@ -6014,7 +6015,7 @@ void KonqMainWindow::saveWindowSize() const
QString savedGroup = KGlobal::config()->group();
KGlobal::config()->setGroup( "KonqMainWindow_Size" );
KParts::MainWindow::saveWindowSize( KGlobal::config() );
KParts::MainWindow::saveWindowSize( KGlobal::config().data() );
KGlobal::config()->setGroup( savedGroup );
KGlobal::config()->sync();
@ -6025,7 +6026,7 @@ void KonqMainWindow::restoreWindowSize()
QString savedGroup = KGlobal::config()->group();
KGlobal::config()->setGroup( "KonqMainWindow_Size" );
KParts::MainWindow::restoreWindowSize( KGlobal::config() );
KParts::MainWindow::restoreWindowSize( KGlobal::config().data() );
KGlobal::config()->setGroup( savedGroup );
}

View file

@ -1307,17 +1307,17 @@ bool KonqView::eventFilter( QObject *obj, QEvent *e )
if ( e->type() == QEvent::FocusIn )
{
setActiveInstance();
setActiveComponent();
}
return false;
}
void KonqView::setActiveInstance()
void KonqView::setActiveComponent()
{
if ( m_bBuiltinView || !m_pPart->instance() /*never!*/)
KGlobal::setActiveInstance( KGlobal::instance() );
if ( m_bBuiltinView || !m_pPart->componentData().isValid() /*never!*/)
KGlobal::setActiveComponent( KGlobal::mainComponent() );
else
KGlobal::setActiveInstance( m_pPart->instance() );
KGlobal::setActiveComponent( m_pPart->componentData() );
}
bool KonqView::prepareReload( KParts::URLArgs& args )

View file

@ -314,8 +314,8 @@ public:
void goHistory( int steps );
// Set the KGlobal active instance (the one used by KBugReport)
void setActiveInstance();
// Set the KGlobal active componentData(the one used by KBugReport)
void setActiveComponent();
// Called before reloading this view. Sets args.reload to true, and offers to repost form data.
// Returns false in case the reload must be canceled.

View file

@ -1077,7 +1077,7 @@ void KonqViewManager::saveViewProfile( const QString & fileName, const QString &
{
QString path = KStandardDirs::locateLocal( "data", QString::fromLatin1( "konqueror/profiles/" ) +
fileName, KGlobal::instance() );
fileName, KGlobal::mainComponent() );
if ( QFile::exists( path ) )
QFile::remove( path );
@ -1296,7 +1296,7 @@ void KonqViewManager::loadViewProfile( KConfig &cfg, const QString & filename,
if( resetWindow )
{ // force default settings for the GUI
m_pMainWindow->applyMainWindowSettings( KGlobal::config(), "KonqMainWindow", true );
m_pMainWindow->applyMainWindowSettings( KGlobal::config().data(), "KonqMainWindow", true );
}
// Apply menu/toolbar settings saved in profile. Read from a separate group
@ -1693,7 +1693,7 @@ void KonqViewManager::profileListDirty( bool broadcast )
m_bProfileListDirty = true;
#if 0
// There's always one profile at least, now...
QStringList profiles = KonqFactory::instance()->dirs()->findAllResources( "data", "konqueror/profiles/*", false, true );
QStringList profiles = KonqFactory::componentData().dirs()->findAllResources( "data", "konqueror/profiles/*", false, true );
if ( m_pamProfiles )
m_pamProfiles->setEnabled( profiles.count() > 0 );
#endif

View file

@ -313,7 +313,7 @@ protected:
const QString &name, const KUrl & defaultURL, bool openUrl, bool openAfterCurrentPage = false );
// Disabled - we do it ourselves
virtual void setActiveInstance( KInstance * ) {}
virtual void setActiveComponent(const KComponentData &) {}
private:

View file

@ -19,7 +19,6 @@
#include <kparts/plugin.h>
class KUrl;
class KInstance;
/**
* KHTML KParts Plugin

View file

@ -49,7 +49,7 @@
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>
#include <kinstance.h>
#include <kcomponentdata.h>
KonqListViewFactory::KonqListViewFactory()
{
@ -75,23 +75,23 @@ KParts::Part* KonqListViewFactory::createPartObject( QWidget *parentWidget, QObj
return obj;
}
KInstance *KonqListViewFactory::instance()
const KComponentData &KonqListViewFactory::componentData()
{
if ( !s_instance )
s_instance = new KInstance( "konqlistview" );
return s_instance;
s_instance = new KComponentData( "konqlistview" );
return *s_instance;
}
KonqPropsView *KonqListViewFactory::defaultViewProps()
{
if ( !s_defaultViewProps )
s_defaultViewProps = new KonqPropsView( instance(),0L );
//s_defaultViewProps = KonqPropsView::defaultProps( instance() );
s_defaultViewProps = new KonqPropsView( componentData(),0L );
//s_defaultViewProps = KonqPropsView::defaultProps( componentData() );
return s_defaultViewProps;
}
KInstance *KonqListViewFactory::s_instance = 0;
KComponentData *KonqListViewFactory::s_instance = 0;
KonqPropsView *KonqListViewFactory::s_defaultViewProps = 0;
K_EXPORT_COMPONENT_FACTORY( konq_listview, KonqListViewFactory )
@ -230,11 +230,11 @@ KonqListView::KonqListView( QWidget *parentWidget, QObject *parent, const QStrin
: KonqDirPart( parent )
,m_headerTimer(0)
{
setInstance( KonqListViewFactory::instance(), false );
setComponentData( KonqListViewFactory::componentData(), false );
// Create a properties instance for this view
// All the listview view modes inherit the same properties defaults...
m_pProps = new KonqPropsView( KonqListViewFactory::instance(), KonqListViewFactory::defaultViewProps() );
m_pProps = new KonqPropsView( KonqListViewFactory::componentData(), KonqListViewFactory::defaultViewProps() );
setBrowserExtension( new ListViewBrowserExtension( this ) );
@ -303,7 +303,7 @@ KonqListView::KonqListView( QWidget *parentWidget, QObject *parent, const QStrin
connect( this, SIGNAL( findOpened( KonqDirPart * ) ), SLOT( slotKFindOpened() ) );
connect( this, SIGNAL( findClosed( KonqDirPart * ) ), SLOT( slotKFindClosed() ) );
loadPlugins( this, this, instance() );
loadPlugins( this, this, componentData() );
}
KonqListView::~KonqListView()

View file

@ -47,11 +47,11 @@ public:
virtual KParts::Part* createPartObject( QWidget *parentWidget, QObject *parent, const char*, const QStringList &args );
static KInstance *instance();
static const KComponentData &componentData();
static KonqPropsView *defaultViewProps();
private:
static KInstance *s_instance;
static KComponentData *s_instance;
static KonqPropsView *s_defaultViewProps;
};

View file

@ -25,7 +25,7 @@ typedef KGenericFactory<CSSConfig, QWidget> CSSFactory;
K_EXPORT_COMPONENT_FACTORY( css, CSSFactory("kcmcss") )
CSSConfig::CSSConfig(QWidget *parent, const QStringList &)
: KCModule(CSSFactory::instance(), parent)
: KCModule(CSSFactory::componentData(), parent)
{
customDialogBase = new KDialog(this);
customDialogBase->setObjectName( "customCSSDialog" );
@ -194,7 +194,7 @@ void CSSConfig::save()
{
CSSTemplate css(templ);
dest = kapp->dirs()->saveLocation("data", "kcmcss");
dest = KGlobal::mainComponent().dirs()->saveLocation("data", "kcmcss");
dest += "/override.css";
css.expand(dest, cssDict());

View file

@ -28,8 +28,8 @@
#include "filteropts.h"
FilterOptions::FilterOptions(KInstance *inst, QWidget *parent)
:KCModule(inst, parent)
FilterOptions::FilterOptions(const KComponentData &componentData, QWidget *parent)
:KCModule(componentData, parent)
{
QGridLayout *lay = new QGridLayout(this);

View file

@ -32,7 +32,7 @@ class FilterOptions : public KCModule
Q_OBJECT
public:
FilterOptions(KInstance *inst, QWidget *parent);
FilterOptions(const KComponentData &inst, QWidget *parent);
void load();
void save();

View file

@ -43,7 +43,7 @@ K_EXPORT_COMPONENT_FACTORY( kurifilt, KURIFactory("kcmkurifilt") )
class FilterOptions;
KURIFilterModule::KURIFilterModule(QWidget *parent, const QStringList &)
:KCModule(KURIFactory::instance(), parent)
:KCModule(KURIFactory::componentData(), parent)
{
filter = KUriFilter::self();

View file

@ -30,7 +30,7 @@ typedef KGenericFactory<FileTypesView> FileTypesViewFactory;
K_EXPORT_COMPONENT_FACTORY(filetypes, FileTypesViewFactory("filetypes"))
FileTypesView::FileTypesView(QWidget *parent, const QStringList &)
: KCModule(FileTypesViewFactory::instance(), parent)
: KCModule(FileTypesViewFactory::componentData(), parent)
{
m_konqConfig = KSharedConfig::openConfig("konquerorrc", false, false);

View file

@ -43,7 +43,7 @@ typedef KGenericFactory<KCacheConfigDialog> KCacheConfigDialogFactory;
K_EXPORT_COMPONENT_FACTORY(cache, KCacheConfigDialogFactory("kcmkio"))
KCacheConfigDialog::KCacheConfigDialog(QWidget *parent, const QStringList &)
: KCModule(KCacheConfigDialogFactory::instance(), parent)
: KCModule(KCacheConfigDialogFactory::componentData(), parent)
{
QVBoxLayout* mainLayout = new QVBoxLayout(this);
mainLayout->setMargin(0);

View file

@ -21,7 +21,7 @@ typedef KGenericFactory<KCookiesMain> KCookiesMainFactory;
K_EXPORT_COMPONENT_FACTORY(cookie, KCookiesMainFactory("kcmkio"))
KCookiesMain::KCookiesMain(QWidget *parent, const QStringList &)
: KCModule(KCookiesMainFactory::instance(), parent)
: KCModule(KCookiesMainFactory::componentData(), parent)
{
management = 0;
bool managerOK = true;
@ -42,13 +42,13 @@ KCookiesMain::KCookiesMain(QWidget *parent, const QStringList &)
tab = new QTabWidget(this);
layout->addWidget(tab);
policies = new KCookiesPolicies(instance(), this);
policies = new KCookiesPolicies(componentData(), this);
tab->addTab(policies, i18n("&Policy"));
connect(policies, SIGNAL(changed(bool)), SIGNAL(changed(bool)));
if( managerOK )
{
management = new KCookiesManagement(instance(), this);
management = new KCookiesManagement(componentData(), this);
tab->addTab(management, i18n("&Management"));
connect(management, SIGNAL(changed(bool)), SIGNAL(changed(bool)));
}

View file

@ -100,8 +100,8 @@ QString CookieListViewItem::text(int f) const
return f == 0 ? KIDNA::toUnicode(mDomain) : QString();
}
KCookiesManagement::KCookiesManagement(KInstance *inst, QWidget *parent)
: KCModule(inst, parent)
KCookiesManagement::KCookiesManagement(const KComponentData &componentData, QWidget *parent)
: KCModule(componentData, parent)
{
// Toplevel layout
QVBoxLayout* mainLayout = new QVBoxLayout(this);

View file

@ -72,7 +72,7 @@ class KCookiesManagement : public KCModule
Q_OBJECT
public:
KCookiesManagement( KInstance *inst, QWidget *parent );
KCookiesManagement(const KComponentData &componentData, QWidget *parent );
~KCookiesManagement();
virtual void load();

View file

@ -44,8 +44,8 @@
#include "kcookiespolicies.h"
KCookiesPolicies::KCookiesPolicies(KInstance *inst, QWidget *parent)
:KCModule(inst, parent)
KCookiesPolicies::KCookiesPolicies(const KComponentData &componentData, QWidget *parent)
:KCModule(componentData, parent)
{
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->setMargin(0);

View file

@ -48,7 +48,7 @@ class KCookiesPolicies : public KCModule
Q_OBJECT
public:
KCookiesPolicies(KInstance *inst, QWidget *parent);
KCookiesPolicies(const KComponentData &componentData, QWidget *parent);
~KCookiesPolicies();
virtual void load();

View file

@ -44,15 +44,15 @@ typedef KGenericFactory<KProxyOptions> KProxyOptionsFactory;
K_EXPORT_COMPONENT_FACTORY(proxy, KProxyOptionsFactory("kcmkio"))
KProxyOptions::KProxyOptions(QWidget *parent, const QStringList &)
: KCModule(KProxyOptionsFactory::instance(), parent)
: KCModule(KProxyOptionsFactory::componentData(), parent)
{
QVBoxLayout *layout = new QVBoxLayout(this);
mTab = new QTabWidget(this);
layout->addWidget(mTab);
mProxy = new KProxyDialog(instance(), mTab);
mSocks = new KSocksConfig(instance(), mTab);
mProxy = new KProxyDialog(componentData(), mTab);
mSocks = new KSocksConfig(componentData(), mTab);
mTab->addTab(mProxy, i18n("&Proxy"));
mTab->addTab(mSocks, i18n("&SOCKS"));
@ -98,8 +98,8 @@ QString KProxyOptions::quickHelp() const
}
KProxyDialog::KProxyDialog( KInstance *inst, QWidget* parent)
:KCModule( inst, parent )
KProxyDialog::KProxyDialog(const KComponentData &componentData, QWidget* parent)
:KCModule(componentData, parent)
{
QVBoxLayout* mainLayout = new QVBoxLayout( this );
mainLayout->setMargin( KDialog::marginHint() );

View file

@ -64,7 +64,7 @@ class KProxyDialog : public KCModule
Q_OBJECT
public:
KProxyDialog( KInstance *inst, QWidget* parent );
KProxyDialog(const KComponentData &componentData, QWidget* parent );
~KProxyDialog();
virtual void load();

View file

@ -27,7 +27,7 @@
#include <kcmoduleloader.h>
#include <klocale.h>
#include <kinstance.h>
#include <kcomponentdata.h>
#include "kcookiesmain.h"
#include "netpref.h"
@ -43,7 +43,7 @@ typedef KGenericFactory<LanBrowser> LanBrowserFactory;
K_EXPORT_COMPONENT_FACTORY(lanbrowser, LanBrowserFactory("kcmkio"))
LanBrowser::LanBrowser(QWidget *parent, const QStringList &)
: KCModule(LanBrowserFactory::instance(), parent)
: KCModule(LanBrowserFactory::componentData(), parent)
, layout(this)
, tabs(this)
{
@ -66,7 +66,7 @@ LanBrowser::LanBrowser(QWidget *parent, const QStringList &)
layout.addWidget(&tabs);
smbPage = new SMBRoOptions(&tabs, QStringList(), instance());
smbPage = new SMBRoOptions(&tabs, QStringList(), componentData());
tabs.addTab(smbPage, i18n("&Windows Shares"));
connect(smbPage,SIGNAL(changed(bool)), SLOT( changed() ));

View file

@ -21,7 +21,7 @@ typedef KGenericFactory<KIOPreferences> KIOPreferencesFactory;
K_EXPORT_COMPONENT_FACTORY(netpref, KIOPreferencesFactory("kcmkio"))
KIOPreferences::KIOPreferences(QWidget *parent, const QStringList &)
: KCModule(KIOPreferencesFactory::instance(), parent)
: KCModule(KIOPreferencesFactory::componentData(), parent)
{
QVBoxLayout* mainLayout = new QVBoxLayout( this );
mainLayout->setMargin( 0 );

View file

@ -38,8 +38,8 @@
typedef KGenericFactory<SMBRoOptions> SMBRoOptionsFactory;
K_EXPORT_COMPONENT_FACTORY(smb, SMBRoOptionsFactory("kcmkio"))
SMBRoOptions::SMBRoOptions(QWidget *parent, const QStringList &, KInstance* inst)
: KCModule(inst ? inst : SMBRoOptionsFactory::instance(), parent)
SMBRoOptions::SMBRoOptions(QWidget *parent, const QStringList &, const KComponentData &componentData)
: KCModule(componentData.isValid() ? componentData : SMBRoOptionsFactory::componentData(), parent)
{
QGridLayout *layout = new QGridLayout(this );
layout->setMargin( KDialog::marginHint() );

View file

@ -33,7 +33,7 @@ class SMBRoOptions : public KCModule
{
Q_OBJECT
public:
SMBRoOptions(QWidget *parent, const QStringList &args, KInstance *inst = 0);
SMBRoOptions(QWidget *parent, const QStringList &args, const KComponentData &componentData = KComponentData());
~SMBRoOptions();
virtual void load();

View file

@ -48,9 +48,10 @@
#include <kaboutdata.h>
#include <kglobal.h>
#include <kconfiggroup.h>
KSocksConfig::KSocksConfig(KInstance *inst, QWidget *parent)
: KCModule(inst, parent)
KSocksConfig::KSocksConfig(const KComponentData &componentData, QWidget *parent)
: KCModule(componentData, parent)
{
KAboutData *about =

View file

@ -46,7 +46,7 @@ class KSocksConfig : public KCModule
{
Q_OBJECT
public:
KSocksConfig(KInstance *inst, QWidget *parent);
KSocksConfig(const KComponentData &componentData, QWidget *parent);
virtual ~KSocksConfig();
SocksBase *base;

View file

@ -49,7 +49,7 @@ typedef KGenericFactory<UserAgentDlg> UserAgentDlgFactory;
K_EXPORT_COMPONENT_FACTORY(useragent, UserAgentDlgFactory("kcmkio"))
UserAgentDlg::UserAgentDlg(QWidget *parent, const QStringList &)
: KCModule(UserAgentDlgFactory::instance(), parent)
: KCModule(UserAgentDlgFactory::componentData(), parent)
{
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->setMargin(0);

View file

@ -34,7 +34,7 @@ typedef KonqKcmFactory<KBehaviourOptions> KBehaviourOptionsFactory;
K_EXPORT_COMPONENT_FACTORY(behavior, KBehaviourOptionsFactory)
KBehaviourOptions::KBehaviourOptions(QWidget *parent, const QStringList &)
: KCModule(_globalInstance(), parent)
: KCModule(KonqKcmFactory<KBehaviourOptions>::componentData(), parent)
, g_pConfig(KSharedConfig::openConfig("konquerorrc", false, true))
, groupname("FMSettings")
{

View file

@ -37,7 +37,7 @@ typedef KonqKcmFactory<KBrowserOptions> KBrowserOptionsFactory;
K_EXPORT_COMPONENT_FACTORY(browser, KBrowserOptionsFactory)
KBrowserOptions::KBrowserOptions(QWidget *parent, const QStringList &)
: KCModule( _globalInstance(), parent )
: KCModule( KonqKcmFactory<KBrowserOptions>::componentData(), parent )
{
KSharedConfig::Ptr config = KSharedConfig::openConfig("konquerorrc", false, true);
QString group = "FMSettings";

View file

@ -36,6 +36,7 @@
#include <knuminput.h>
#include <kconfig.h>
#include "konqkcmfactory.h"
#include <kconfiggroup.h>
#include <netwm.h>
@ -55,7 +56,7 @@ K_EXPORT_COMPONENT_FACTORY(ddesktop, KDesktopConfigFactory)
// asking why I did not implement a more intelligent/smaller GUI.
KDesktopConfig::KDesktopConfig(QWidget *parent, const QStringList &)
: KCModule(_globalInstance(), parent)
: KCModule(KonqKcmFactory<KDesktopConfig>::componentData(), parent)
{
setQuickHelp( i18n("<h1>Multiple Desktops</h1>In this module, you can configure how many virtual desktops you want and how these should be labeled."));

View file

@ -55,7 +55,7 @@ typedef KonqKcmFactory<DesktopBehaviorModule> DesktopBehaviorModuleFactory;
K_EXPORT_COMPONENT_FACTORY(dbehavior, DesktopBehaviorModuleFactory)
DesktopBehaviorModule::DesktopBehaviorModule(QWidget *parent, const QStringList &)
: KCModule( _globalInstance(), parent )
: KCModule( KonqKcmFactory<DesktopBehaviorModule>::componentData(), parent )
{
KSharedConfig::Ptr config = KSharedConfig::openConfig(_desktopConfigName(), false, false);
QVBoxLayout* layout = new QVBoxLayout(this);

View file

@ -63,7 +63,7 @@ K_EXPORT_COMPONENT_FACTORY(dappearance, KonqFontOptionsDesktopFactory)
//-----------------------------------------------------------------------------
KonqFontOptions::KonqFontOptions(QWidget *parent, const QStringList &, bool desktop)
: KCModule( _globalInstance(), parent )
: KCModule( KonqKcmFactory<KonqFontOptions>::componentData(), parent )
, groupname("FMSettings")
, m_bDesktop(desktop)
{

View file

@ -1,5 +1,5 @@
/* This file is part of the KDE project
Copyright (C) 2006 Matthias Kretz <kretz@kde.org>
Copyright (C) 2006-2007 Matthias Kretz <kretz@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@ -18,20 +18,10 @@
*/
#include "konqkcmfactory.h"
#include <kinstance.h>
#include <kcomponentdata.h>
#include <QDesktopWidget>
#include <kapplication.h>
static KInstance *_kcmkonq = 0;
KInstance* _globalInstance()
{
if (_kcmkonq)
return _kcmkonq;
_kcmkonq = new KInstance("kcmkonq");
return _kcmkonq;
}
QString _desktopConfigName()
{
int desktop = KApplication::desktop()->primaryScreen();
@ -44,4 +34,4 @@ QString _desktopConfigName()
return name;
}
// vim: sw=4 ts=4 noet
// vim: sw=4 ts=4 et

View file

@ -1,5 +1,5 @@
/* This file is part of the KDE project
Copyright (C) 2006 Matthias Kretz <kretz@kde.org>
Copyright (C) 2006-2007 Matthias Kretz <kretz@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@ -21,9 +21,8 @@
#define KONQKCMFACTORY_H
#include <kgenericfactory.h>
class KInstance;
#include <kcomponentdata.h>
KInstance* _globalInstance();
QString _desktopConfigName();
template<class T>
@ -31,6 +30,9 @@ class KonqKcmFactory : public KGenericFactory<T>
{
public:
KonqKcmFactory() : KGenericFactory<T>("kcmkonq") {}
protected:
virtual KComponentData *createComponentData() { return new KComponentData("kcmkonq"); }
};
#endif // KONQKCMFACTORY_H

View file

@ -40,6 +40,7 @@
#include "previews.h"
#include "konqkcmfactory.h"
#include <kconfiggroup.h>
//-----------------------------------------------------------------------------
@ -65,7 +66,7 @@ typedef KonqKcmFactory<KPreviewOptions> KPreviewOptionsFactory;
K_EXPORT_COMPONENT_FACTORY(previews, KPreviewOptionsFactory)
KPreviewOptions::KPreviewOptions( QWidget *parent, const QStringList & )
: KCModule( _globalInstance(), parent )
: KCModule( KonqKcmFactory<KPreviewOptions>::componentData(), parent )
{
QVBoxLayout *lay = new QVBoxLayout(this);
lay->setSpacing(KDialog::spacingHint());

View file

@ -39,6 +39,7 @@
#include <kstandarddirs.h>
#include <konq_defaults.h> // include default values directly from libkonq
#include <kurlrequester.h>
#include <kconfiggroup.h>
#include "rootopts.h"
#include "konqkcmfactory.h"
@ -51,7 +52,7 @@ typedef KonqKcmFactory<DesktopPathConfig> DesktopPathConfigFactory;
K_EXPORT_COMPONENT_FACTORY(dpath, DesktopPathConfigFactory)
DesktopPathConfig::DesktopPathConfig(QWidget *parent, const QStringList &)
: KCModule( _globalInstance(), parent )
: KCModule( KonqKcmFactory<DesktopPathConfig>::componentData(), parent )
{
QLabel * tmpLabel;
@ -146,7 +147,7 @@ void DesktopPathConfig::defaults()
void DesktopPathConfig::save()
{
KConfig *config = KGlobal::config();
KSharedConfig::Ptr config = KGlobal::config();
KConfigGroup configGroup( config, "Paths" );
bool pathChanged = false;

View file

@ -30,7 +30,7 @@ typedef KGenericFactory<KAppearanceOptions, QWidget> KAppearanceOptionsFactory;
K_EXPORT_COMPONENT_FACTORY( khtml_fonts, KAppearanceOptionsFactory("kcmkonqhtml") )
KAppearanceOptions::KAppearanceOptions(QWidget *parent, const QStringList&)
: KCModule( KAppearanceOptionsFactory::instance(), parent ), m_groupname("HTML Settings"),
: KCModule( KAppearanceOptionsFactory::componentData(), parent ), m_groupname("HTML Settings"),
fSize( 10 ), fMinSize( HTML_DEFAULT_MIN_FONT_SIZE )
{

View file

@ -41,7 +41,7 @@ typedef KGenericFactory<KCMFilter, QWidget> KCMFilterFactory;
K_EXPORT_COMPONENT_FACTORY( khtml_filter, KCMFilterFactory("kcmkonqhtml") )
KCMFilter::KCMFilter( QWidget *parent, const QStringList& )
: KCModule( KCMFilterFactory::instance(), parent ),
: KCModule( KCMFilterFactory::componentData(), parent ),
mGroupname( "Filter Settings" ),
mSelCount(0)
{

View file

@ -37,7 +37,7 @@ enum AnimationsType { AnimationsAlways=0, AnimationsNever=1, AnimationsLoopOnce=
//-----------------------------------------------------------------------------
KMiscHTMLOptions::KMiscHTMLOptions(QWidget *parent, const QStringList&)
: KCModule( KMiscHTMLOptionsFactory::instance(), parent ), m_groupname("HTML Settings")
: KCModule( KMiscHTMLOptionsFactory::componentData(), parent ), m_groupname("HTML Settings")
{
m_pConfig = KSharedConfig::openConfig( "konquerorrc", false, false );
int row = 0;

View file

@ -48,8 +48,8 @@ JavaPolicies::~JavaPolicies() {
// == class KJavaOptions =====
KJavaOptions::KJavaOptions( KSharedConfig::Ptr config, QString group,
KInstance *inst, QWidget *parent )
: KCModule( inst, parent ),
const KComponentData &componentData, QWidget *parent )
: KCModule( componentData, parent ),
_removeJavaScriptDomainAdvice(false),
m_pConfig( config ),
m_groupname( group ),

View file

@ -87,7 +87,7 @@ class KJavaOptions : public KCModule
Q_OBJECT
public:
KJavaOptions( KSharedConfig::Ptr config, QString group, KInstance *inst, QWidget* parent );
KJavaOptions( KSharedConfig::Ptr config, QString group, const KComponentData &componentData, QWidget* parent );
virtual void load();
virtual void save();

View file

@ -33,8 +33,8 @@
// == class KJavaScriptOptions =====
KJavaScriptOptions::KJavaScriptOptions( KSharedConfig::Ptr config, QString group, KInstance *inst, QWidget *parent) :
KCModule( inst, parent ),
KJavaScriptOptions::KJavaScriptOptions( KSharedConfig::Ptr config, QString group, const KComponentData &componentData, QWidget *parent) :
KCModule(componentData, parent),
_removeJavaScriptDomainAdvice(false),
m_pConfig( config ), m_groupname( group ),
js_global_policies(config,group,true,QString()),

View file

@ -56,7 +56,7 @@ class KJavaScriptOptions : public KCModule
{
Q_OBJECT
public:
KJavaScriptOptions( KSharedConfig::Ptr config, QString group, KInstance *inst, QWidget* parent );
KJavaScriptOptions( KSharedConfig::Ptr config, QString group, const KComponentData &componentData, QWidget* parent );
virtual void load();
virtual void save();

View file

@ -8,8 +8,8 @@
#include "khttpoptdlg.h"
KHTTPOptions::KHTTPOptions(KSharedConfig::Ptr config, QString group, KInstance *inst, QWidget *parent)
: KCModule( inst, parent ), m_pConfig(config), m_groupname(group)
KHTTPOptions::KHTTPOptions(KSharedConfig::Ptr config, QString group, const KComponentData &componentData, QWidget *parent)
: KCModule( componentData, parent ), m_pConfig(config), m_groupname(group)
{
QVBoxLayout *lay = new QVBoxLayout(this);
lay->setMargin(10);

View file

@ -19,7 +19,7 @@ class KHTTPOptions : public KCModule
{
Q_OBJECT
public:
KHTTPOptions(KSharedConfig::Ptr config, QString group, KInstance *inst, QWidget *parent);
KHTTPOptions(KSharedConfig::Ptr config, QString group, const KComponentData &componentData, QWidget *parent);
virtual void load();
virtual void save();

View file

@ -46,7 +46,7 @@ typedef KGenericFactory<KJSParts, QWidget> KJSPartsFactory;
K_EXPORT_COMPONENT_FACTORY( khtml_java_js, KJSPartsFactory("kcmkonqhtml") )
KJSParts::KJSParts(QWidget *parent, const QStringList&)
: KCModule(KJSPartsFactory::instance(), parent)
: KCModule(KJSPartsFactory::componentData(), parent)
{
mConfig = KSharedConfig::openConfig( "konquerorrc", false, false );
KAboutData *about =
@ -73,11 +73,11 @@ KJSParts::KJSParts(QWidget *parent, const QStringList&)
layout->addWidget(tab);
// ### the groupname is duplicated in KJSParts::save
java = new KJavaOptions( mConfig, "Java/JavaScript Settings", instance(), this );
java = new KJavaOptions( mConfig, "Java/JavaScript Settings", componentData(), this );
tab->addTab( java, i18n( "&Java" ) );
connect( java, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) );
javascript = new KJavaScriptOptions( mConfig, "Java/JavaScript Settings", instance(), this );
javascript = new KJavaScriptOptions( mConfig, "Java/JavaScript Settings", componentData(), this );
tab->addTab( javascript, i18n( "Java&Script" ) );
connect( javascript, SIGNAL( changed( bool ) ), SIGNAL( changed( bool ) ) );
}

View file

@ -51,7 +51,7 @@ typedef KGenericFactory<KPluginOptions, QWidget> KPluginOptionsFactory;
K_EXPORT_COMPONENT_FACTORY( khtml_plugins, KPluginOptionsFactory("kcmkonqhtml") )
KPluginOptions::KPluginOptions( QWidget *parent, const QStringList& )
: KCModule( KPluginOptionsFactory::instance(), parent ),
: KCModule( KPluginOptionsFactory::componentData(), parent ),
m_pConfig( KSharedConfig::openConfig( "konquerorrc", false, false ) ),
m_groupname( "Java/JavaScript Settings" ),
global_policies(m_pConfig,m_groupname,true)

View file

@ -38,7 +38,7 @@ namespace KCMPerformance
{
Config::Config( QWidget* parent_P, const QStringList & )
: KCModule( KCMPerformanceConfigFactory::instance(), parent_P )
: KCModule( KCMPerformanceConfigFactory::componentData(), parent_P )
{
setQuickHelp( i18n( "<h1>KDE Performance</h1>"
" You can configure settings that improve KDE performance here." ));
@ -76,7 +76,7 @@ void Config::defaults()
}
KonquerorConfig::KonquerorConfig( QWidget* parent_P, const QStringList & )
: KCModule( KCMPerformanceKonquerorConfigFactory::instance(), parent_P )
: KCModule( KCMPerformanceKonquerorConfigFactory::componentData(), parent_P )
{
setQuickHelp( i18n( "<h1>Konqueror Performance</h1>"
" You can configure several settings that improve Konqueror performance here."

View file

@ -26,7 +26,7 @@ KonqSidebar::KonqSidebar( QWidget *parentWidget, QObject *parent, bool universal
: KParts::ReadOnlyPart(parent),KonqSidebarIface()
{
// we need an instance
setInstance( KonqSidebarFactory::instance() );
setComponentData(KonqSidebarFactory::componentData());
m_extension = 0;
// this should be your custom internal widget
m_widget = new Sidebar_Widget( parentWidget, this, universalMode, parentWidget->topLevelWidget()->property("currentProfile").toString() );
@ -40,10 +40,10 @@ KonqSidebar::KonqSidebar( QWidget *parentWidget, QObject *parent, bool universal
setWidget(m_widget);
}
KInstance *KonqSidebar::getInstance()
const KComponentData &KonqSidebar::getInstance()
{
kDebug() << "KonqSidebar::getInstance()" << endl;
return KonqSidebarFactory::instance();
return KonqSidebarFactory::componentData();
}
KonqSidebar::~KonqSidebar()
@ -78,9 +78,9 @@ void KonqSidebar::customEvent(QCustomEvent* ev)
// notable exception of the KAboutData data
#include <kaboutdata.h>
#include <klocale.h>
#include <kinstance.h>
#include <kcomponentdata.h>
KInstance* KonqSidebarFactory::s_instance = 0L;
KComponentData *KonqSidebarFactory::s_instance = 0L;
KAboutData* KonqSidebarFactory::s_about = 0L;
KonqSidebarFactory::KonqSidebarFactory()
@ -109,15 +109,15 @@ KParts::Part* KonqSidebarFactory::createPartObject( QWidget *parentWidget, QObje
return obj;
}
KInstance* KonqSidebarFactory::instance()
const KComponentData &KonqSidebarFactory::componentData()
{
if( !s_instance )
{
s_about = new KAboutData("konqsidebartng", I18N_NOOP("Extended Sidebar"), "0.1");
s_about->addAuthor("Joseph WENNINGER", 0, "jowenn@bigfoot.com");
s_instance = new KInstance(s_about);
s_instance = new KComponentData(s_about);
}
return s_instance;
return *s_instance;
}
K_EXPORT_COMPONENT_FACTORY( konq_sidebar, KonqSidebarFactory )

View file

@ -87,7 +87,7 @@ public:
virtual bool openUrl(const KUrl &url);
KonqSidebarBrowserExtension* extension() const
{ return m_extension; }
KInstance *getInstance();
const KComponentData &getInstance();
virtual bool universalMode() {return m_universalMode;}
protected:
/**
@ -103,7 +103,7 @@ private:
bool m_universalMode;
};
class KInstance;
class KComponentData;
class KAboutData;
class KonqSidebarFactory : public KParts::Factory
@ -114,10 +114,10 @@ public:
virtual ~KonqSidebarFactory();
virtual KParts::Part* createPartObject( QWidget *parentWidget, QObject *parent,
const char *classname, const QStringList &args );
static KInstance* instance();
static const KComponentData &componentData();
private:
static KInstance* s_instance;
static KComponentData *s_instance;
static KAboutData* s_about;
};

View file

@ -22,17 +22,17 @@
#include <kdebug.h>
KonqSidebarPlugin::KonqSidebarPlugin(KInstance *instance,QObject *parent,
KonqSidebarPlugin::KonqSidebarPlugin(const KComponentData &componentData,QObject *parent,
QWidget * /*widgetParent*/, QString &desktopName_, const char* name)
: QObject(parent), desktopName(desktopName_)
{
setObjectName( name );
m_parentInstance=instance;
m_parentInstance=componentData;
}
KonqSidebarPlugin::~KonqSidebarPlugin() { }
KInstance *KonqSidebarPlugin::parentInstance(){return m_parentInstance;}
const KComponentData &KonqSidebarPlugin::parentInstance(){return m_parentInstance;}
void KonqSidebarPlugin::openUrl(const KUrl& url){handleURL(url);}

View file

@ -27,6 +27,7 @@
#include <kio/job.h>
#include <QPointer>
#include <kfileitem.h>
#include <kcomponentdata.h>
class KonqSidebarPluginPrivate;
@ -34,17 +35,17 @@ class KDE_EXPORT KonqSidebarPlugin : public QObject
{
Q_OBJECT
public:
KonqSidebarPlugin(KInstance *instance,QObject *parent,QWidget *widgetParent,QString &desktopName_, const char* name=0);
KonqSidebarPlugin(const KComponentData &componentData,QObject *parent,QWidget *widgetParent,QString &desktopName_, const char* name=0);
~KonqSidebarPlugin();
virtual QWidget *getWidget()=0;
virtual void *provides(const QString &)=0;
KInstance *parentInstance();
const KComponentData &parentInstance();
protected:
virtual void handleURL(const KUrl &url)=0;
virtual void handlePreview(const KFileItemList & items);
virtual void handlePreviewOnMouseOver(const KFileItem &items); //not used yet, perhaps in KDE 3.1
QString desktopName;
KInstance* m_parentInstance;
KComponentData m_parentInstance;
private:
KonqSidebarPluginPrivate *d;

View file

@ -858,8 +858,8 @@ KonqSidebarPlugin *Sidebar_Widget::loadModule(QWidget *par,QString &desktopName,
{
// create the module
KonqSidebarPlugin* (*func)(KInstance*,QObject *, QWidget*, QString&, const char *);
func = (KonqSidebarPlugin* (*)(KInstance*,QObject *, QWidget *, QString&, const char *)) create;
KonqSidebarPlugin* (*func)(const KComponentData &,QObject *, QWidget*, QString&, const char *);
func = (KonqSidebarPlugin* (*)(const KComponentData &,QObject *, QWidget *, QString&, const char *)) create;
QString fullPath(m_path+desktopName);
return (KonqSidebarPlugin*)func(getInstance(),bi,par,fullPath,0);
}
@ -1039,7 +1039,7 @@ void Sidebar_Widget::dockWidgetHasUndocked(K3DockWidget* wid)
}
}
KInstance *Sidebar_Widget::getInstance()
const KComponentData &Sidebar_Widget::getInstance()
{
return ((KonqSidebar*)m_partParent)->getInstance();
}

View file

@ -141,7 +141,7 @@ Q_SIGNALS:
public:
/* interface KonqSidebar_PluginInterface*/
KInstance *getInstance();
const KComponentData &getInstance();
// virtual void showError(QString &); for later extension
// virtual void showMessage(QString &); for later extension
/* end of interface implementation */

View file

@ -15,12 +15,12 @@
* *
***************************************************************************/
#include "konqsidebartest.moc"
#include <kinstance.h>
#include <kcomponentdata.h>
extern "C"
{
KDE_EXPORT void* create_konq_sidebartest(KInstance *instance,QObject *par,QWidget *widp,QString &desktopname,const char *name)
KDE_EXPORT void* create_konq_sidebartest(const KComponentData &componentData,QObject *par,QWidget *widp,QString &desktopname,const char *name)
{
return new SidebarTest(instance,par,widp,desktopname,name);
return new SidebarTest(componentData,par,widp,desktopname,name);
}
};

View file

@ -24,8 +24,8 @@ class SidebarTest : public KonqSidebarPlugin
{
Q_OBJECT
public:
SidebarTest(KInstance *inst,QObject *parent,QWidget *widgetParent, QString &desktopName_, const char* name=0):
KonqSidebarPlugin(inst,parent,widgetParent,desktopName_,name)
SidebarTest(const KComponentData &componentData,QObject *parent,QWidget *widgetParent, QString &desktopName_, const char* name=0):
KonqSidebarPlugin(componentData,parent,widgetParent,desktopName_,name)
{
widget=new QLabel("Init Value",widgetParent);
}

View file

@ -37,6 +37,7 @@
#include "history_module.h"
#include "history_settings.h"
#include <kconfiggroup.h>
static KStaticDeleter<KonqSidebarHistorySettings> sd;
KonqSidebarHistorySettings * KonqSidebarHistoryModule::s_settings = 0L;
@ -60,7 +61,7 @@ KonqSidebarHistoryModule::KonqSidebarHistoryModule( KonqSidebarTree * parentTree
m_dict.setAutoDelete( true );
m_currentTime = QDateTime::currentDateTime();
KConfig *kc = KGlobal::config();
KSharedConfig::Ptr kc = KGlobal::config();
KConfigGroup cs( kc, "HistorySettings" );
m_sortsByName = cs.readEntry( "SortHistory", "byDate" ) == "byName";
@ -128,7 +129,7 @@ KonqSidebarHistoryModule::~KonqSidebarHistoryModule()
++it;
}
KConfig *kc = KGlobal::config();
KSharedConfig::Ptr kc = KGlobal::config();
KConfigGroup cs( kc, "HistorySettings" );
cs.writeEntry("OpenGroups", openGroups);
kc->sync();
@ -158,7 +159,7 @@ void KonqSidebarHistoryModule::slotCreateItems()
item = new KonqSidebarHistoryItem( (*it), group, m_topLevelItem );
}
KConfig *kc = KGlobal::config();
KSharedConfig::Ptr kc = KGlobal::config();
KConfigGroup cs( kc, "HistorySettings" );
QStringList openGroups = cs.readEntry("OpenGroups",QStringList());
QStringList::Iterator it2 = openGroups.begin();
@ -312,7 +313,7 @@ void KonqSidebarHistoryModule::sortingChanged()
{
m_topLevelItem->sort();
KConfig *kc = KGlobal::config();
KSharedConfig::Ptr kc = KGlobal::config();
KConfigGroup cs( kc, "HistorySettings" );
cs.writeEntry( "SortHistory", m_sortsByName ? "byName" : "byDate" );
kc->sync();

View file

@ -41,7 +41,7 @@ KonqSidebarHistorySettings::~KonqSidebarHistorySettings()
void KonqSidebarHistorySettings::readSettings(bool global)
{
KConfig *config;
KSharedConfigPtr config;
QString oldgroup;
if (global) {
@ -49,7 +49,7 @@ void KonqSidebarHistorySettings::readSettings(bool global)
oldgroup= config->group();
}
else
config = new KConfig("konquerorrc");
config = KSharedConfig::openConfig("konquerorrc");
config->setGroup("HistorySettings");
m_valueYoungerThan = config->readEntry("Value youngerThan", 1 );
@ -70,8 +70,6 @@ void KonqSidebarHistorySettings::readSettings(bool global)
m_fontOlderThan );
if (global)
config->setGroup( oldgroup );
else
delete config;
}
void KonqSidebarHistorySettings::applySettings()

View file

@ -46,7 +46,7 @@ typedef KGenericFactory<HistorySidebarConfig, QWidget > KCMHistoryFactory;
K_EXPORT_COMPONENT_FACTORY (history, KCMHistoryFactory("kcmhistory") )
HistorySidebarConfig::HistorySidebarConfig( QWidget *parent, const QStringList & )
: KCModule (KCMHistoryFactory::instance(), parent, QStringList())
: KCModule (KCMHistoryFactory::componentData(), parent, QStringList())
{
KGlobal::locale()->insertCatalog("konqueror");

View file

@ -13,8 +13,8 @@
#include <QToolButton>
#include <QApplication>
KonqSidebar_Tree::KonqSidebar_Tree(KInstance *instance,QObject *parent,QWidget *widgetParent, QString &desktopName_, const char* name):
KonqSidebarPlugin(instance,parent,widgetParent,desktopName_,name)
KonqSidebar_Tree::KonqSidebar_Tree(const KComponentData &componentData,QObject *parent,QWidget *widgetParent, QString &desktopName_, const char* name):
KonqSidebarPlugin(componentData,parent,widgetParent,desktopName_,name)
{
KSimpleConfig ksc(desktopName_);
ksc.setGroup("Desktop Entry");
@ -115,9 +115,9 @@ void KonqSidebar_Tree::rename()
extern "C"
{
KDE_EXPORT void* create_konqsidebar_tree(KInstance *inst,QObject *par,QWidget *widp,QString &desktopname,const char *name)
KDE_EXPORT void* create_konqsidebar_tree(const KComponentData &componentData,QObject *par,QWidget *widp,QString &desktopname,const char *name)
{
return new KonqSidebar_Tree(inst,par,widp,desktopname,name);
return new KonqSidebar_Tree(componentData,par,widp,desktopname,name);
}
}

View file

@ -17,7 +17,7 @@ class KonqSidebar_Tree: public KonqSidebarPlugin
{
Q_OBJECT
public:
KonqSidebar_Tree(KInstance *instance,QObject *parent,QWidget *widgetParent, QString &desktopName_, const char* name=0);
KonqSidebar_Tree(const KComponentData &componentData,QObject *parent,QWidget *widgetParent, QString &desktopName_, const char* name=0);
~KonqSidebar_Tree();
virtual void *provides(const QString &);
// void emitStatusBarText (const QString &);

View file

@ -32,8 +32,8 @@
#include <khbox.h>
KonqSideBarWebModule::KonqSideBarWebModule(KInstance *instance, QObject *parent, QWidget *widgetParent, QString &desktopName, const char* name)
: KonqSidebarPlugin(instance, parent, widgetParent, desktopName, name)
KonqSideBarWebModule::KonqSideBarWebModule(const KComponentData &componentData, QObject *parent, QWidget *widgetParent, QString &desktopName, const char* name)
: KonqSidebarPlugin(componentData, parent, widgetParent, desktopName, name)
{
_htmlPart = new KHTMLSideBar(universalMode());
connect(_htmlPart, SIGNAL(reload()), this, SLOT(reload()));
@ -187,8 +187,8 @@ void KonqSideBarWebModule::pageLoaded() {
extern "C" {
KDE_EXPORT KonqSidebarPlugin* create_konqsidebar_web(KInstance *instance, QObject *parent, QWidget *widget, QString &desktopName, const char *name) {
return new KonqSideBarWebModule(instance, parent, widget, desktopName, name);
KDE_EXPORT KonqSidebarPlugin* create_konqsidebar_web(const KComponentData &componentData, QObject *parent, QWidget *widget, QString &desktopName, const char *name) {
return new KonqSideBarWebModule(componentData, parent, widget, desktopName, name);
}
}

View file

@ -165,7 +165,7 @@ class KonqSideBarWebModule : public KonqSidebarPlugin
{
Q_OBJECT
public:
KonqSideBarWebModule(KInstance *instance, QObject *parent,
KonqSideBarWebModule(const KComponentData &componentData, QObject *parent,
QWidget *widgetParent, QString &desktopName,
const char *name);
virtual ~KonqSideBarWebModule();

View file

@ -349,7 +349,7 @@ void KWrite::editKeys()
void KWrite::editToolbars()
{
saveMainWindowSettings( KGlobal::config(), "MainWindow" );
saveMainWindowSettings( KGlobal::config().data(), "MainWindow" );
KEditToolbar *dlg = new KEditToolbar(guiFactory());
connect( dlg, SIGNAL(newToolbarConfig()), this, SLOT(slotNewToolbarConfig()) );
@ -359,7 +359,7 @@ void KWrite::editToolbars()
void KWrite::slotNewToolbarConfig()
{
applyMainWindowSettings( KGlobal::config(), "MainWindow" );
applyMainWindowSettings( KGlobal::config().data(), "MainWindow" );
}
void KWrite::dragEnterEvent( QDragEnterEvent *event )
@ -403,16 +403,16 @@ void KWrite::slotEnableActions( bool enable )
}
//common config
void KWrite::readConfig(KConfig *config)
void KWrite::readConfig(KSharedConfigPtr config)
{
config->setGroup("General Options");
m_paShowStatusBar->setChecked( config->readEntry("ShowStatusBar", QVariant(false)).toBool() );
m_paShowPath->setChecked( config->readEntry("ShowPath", QVariant(false)).toBool() );
m_recentFiles->loadEntries(config, "Recent Files");
m_recentFiles->loadEntries(config.data(), "Recent Files");
m_view->document()->editor()->readConfig(config);
m_view->document()->editor()->readConfig(config.data());
if( m_paShowStatusBar->isChecked() )
statusBar()->show();
@ -420,16 +420,16 @@ void KWrite::readConfig(KConfig *config)
statusBar()->hide();
}
void KWrite::writeConfig(KConfig *config)
void KWrite::writeConfig(KSharedConfigPtr config)
{
config->setGroup("General Options");
config->writeEntry("ShowStatusBar",m_paShowStatusBar->isChecked());
config->writeEntry("ShowPath",m_paShowPath->isChecked());
m_recentFiles->saveEntries(config, "Recent Files");
m_recentFiles->saveEntries(config.data(), "Recent Files");
m_view->document()->editor()->writeConfig(config);
m_view->document()->editor()->writeConfig(config.data());
config->sync ();
}
@ -437,14 +437,12 @@ void KWrite::writeConfig(KConfig *config)
//config file
void KWrite::readConfig()
{
KConfig *config = KGlobal::config();
readConfig(config);
readConfig(KGlobal::config());
}
void KWrite::writeConfig()
{
KConfig *config = KGlobal::config();
writeConfig(config);
writeConfig(KGlobal::config());
}
// session management
@ -453,21 +451,21 @@ void KWrite::restore(KConfig *config, int n)
readPropertiesInternal(config, n);
}
void KWrite::readProperties(KConfig *config)
void KWrite::readProperties(KSharedConfigPtr config)
{
readConfig(config);
if (KTextEditor::SessionConfigInterface *iface = qobject_cast<KTextEditor::SessionConfigInterface *>(m_view))
iface->readSessionConfig(config);
iface->readSessionConfig(config.data());
}
void KWrite::saveProperties(KConfig *config)
void KWrite::saveProperties(KSharedConfigPtr config)
{
writeConfig(config);
config->writeEntry("DocumentNumber",docList.indexOf(m_view->document()) + 1);
if (KTextEditor::SessionConfigInterface *iface = qobject_cast<KTextEditor::SessionConfigInterface *>(m_view))
iface->writeSessionConfig(config);
iface->writeSessionConfig(config.data());
}
void KWrite::saveGlobalProperties(KConfig *config) //save documents

View file

@ -27,7 +27,7 @@
#include <kparts/mainwindow.h>
#include <kdialog.h>
#include <kdialog.h>
#include <kconfig.h>
//Added by qt3to4:
#include <QDragEnterEvent>
#include <QDropEvent>
@ -91,8 +91,8 @@ class KWrite : public KParts::MainWindow
//config file functions
public:
void readConfig (KConfig *);
void writeConfig (KConfig *);
void readConfig (KSharedConfigPtr);
void writeConfig (KSharedConfigPtr);
void readConfig ();
void writeConfig ();
@ -103,8 +103,8 @@ class KWrite : public KParts::MainWindow
static void restore();
private:
void readProperties(KConfig *);
void saveProperties(KConfig *);
void readProperties(KSharedConfigPtr);
void saveProperties(KSharedConfigPtr);
void saveGlobalProperties(KConfig *);
private:

View file

@ -29,7 +29,7 @@
#include <kdesktopfile.h>
#include <kdirwatch.h>
#include <kicon.h>
#include <kinstance.h>
#include <kcomponentdata.h>
#include <kinputdialog.h>
#include <klocale.h>
#include <kmessagebox.h>
@ -348,7 +348,7 @@ void KNewMenu::slotFillTemplates()
if ( ! s_pDirWatch )
{
s_pDirWatchStaticDeleter.setObject( s_pDirWatch, new KDirWatch );
QStringList dirs = d->m_actionCollection->instance()->dirs()->resourceDirs("templates");
QStringList dirs = d->m_actionCollection->componentData().dirs()->resourceDirs("templates");
for ( QStringList::Iterator it = dirs.begin() ; it != dirs.end() ; ++it )
{
//kDebug(1203) << "Templates resource dir: " << *it << endl;
@ -368,7 +368,7 @@ void KNewMenu::slotFillTemplates()
s_templatesList->clear();
// Look into "templates" dirs.
QStringList files = d->m_actionCollection->instance()->dirs()->findAllResources("templates");
QStringList files = d->m_actionCollection->componentData().dirs()->findAllResources("templates");
QMap<QString, KNewMenuEntry> slist; // used for sorting
for ( QStringList::Iterator it = files.begin() ; it != files.end() ; ++it )
{

View file

@ -30,6 +30,7 @@
#include <kcompletion.h>
#include <zlib.h> // for crc32
#include <kconfiggroup.h>
const int KonqHistoryManager::s_historyVersion = 4;
@ -40,7 +41,7 @@ KonqHistoryManager::KonqHistoryManager( QObject *parent )
m_updateTimer = new QTimer( this );
// defaults
KConfig *config = KGlobal::config();
KSharedConfig::Ptr config = KGlobal::config();
KConfigGroup cs( config, "HistorySettings" );
m_maxCount = cs.readEntry( "Maximum of History entries", 500 );
m_maxCount = qMax( 1, m_maxCount );
@ -501,7 +502,7 @@ void KonqHistoryManager::slotNotifyMaxCount( int count, const QDBusMessage& msg
clearPending();
adjustSize();
KConfig *config = KGlobal::config();
KSharedConfig::Ptr config = KGlobal::config();
KConfigGroup cs( config, "HistorySettings" );
cs.writeEntry( "Maximum of History entries", m_maxCount );
@ -517,7 +518,7 @@ void KonqHistoryManager::slotNotifyMaxAge( int days, const QDBusMessage& msg )
clearPending();
adjustSize();
KConfig *config = KGlobal::config();
KSharedConfig::Ptr config = KGlobal::config();
KConfigGroup cs( config, "HistorySettings" );
cs.writeEntry( "Maximum age of History entries", m_maxAgeDays );

View file

@ -62,6 +62,7 @@
#include <assert.h>
#include <unistd.h>
#include <klocale.h>
#include <kconfiggroup.h>
struct KonqIconViewWidgetPrivate
@ -348,6 +349,7 @@ void KonqIconViewWidget::slotOnItem( Q3IconViewItem *_item )
}
// ## shouldn't this be disabled during rectangular selection too ?
kDebug(1203) << "about to start sound preview: bSoundPreviews=" << d->bSoundPreviews << ", pSoundPlayer=" << d->pSoundPlayer << ", isMimeTypeKnown=" << d->pSoundPlayer->isMimeTypeKnown(item->item()->mimetype()) << ", showFilePreview=" << KGlobalSettings::showFilePreview(item->item()->url()) << ", activeWindow=" << (window() == qApp->activeWindow()) << endl;
if (d->bSoundPreviews && d->pSoundPlayer &&
d->pSoundPlayer->isMimeTypeKnown(item->item()->mimetype())
&& KGlobalSettings::showFilePreview(item->item()->url())

View file

@ -60,6 +60,7 @@
#include <assert.h>
#include <unistd.h>
#include <kconfiggroup.h>
KonqOperations::KonqOperations( QWidget *parent )
: QObject( parent ),
@ -279,7 +280,7 @@ bool KonqOperations::askDeleteConfirmation( const KUrl::List & selectedUrls, int
if (!keyName.isEmpty())
{
// Check kmessagebox setting... erase & copy to konquerorrc.
KConfig *config = KGlobal::config();
KSharedConfig::Ptr config = KGlobal::config();
KConfigGroup saver(config, "Notification Messages");
if (!saver.readEntry(keyName, QVariant(true)).toBool())
{
@ -633,7 +634,7 @@ void KonqOperations::rename( QWidget * parent, const KUrl & oldurl, const KUrl&
if ( oldurl.isLocalFile() && oldurl.path( KUrl::AddTrailingSlash ) == KGlobalSettings::desktopPath() )
{
kDebug(1203) << "That rename was the Desktop path, updating config files" << endl;
KConfig *globalConfig = KGlobal::config();
KSharedConfig::Ptr globalConfig = KGlobal::config();
KConfigGroup cgs( globalConfig, "Paths" );
cgs.writePathEntry("Desktop" , newurl.path(), KConfigBase::Persistent|KConfigBase::Global );
cgs.sync();

View file

@ -29,6 +29,7 @@
#include <kprotocolinfo.h>
#include <kstaticdeleter.h>
#include <kconfiggroup.h>
KonqPixmapProvider * KonqPixmapProvider::s_self = 0;
static KStaticDeleter<KonqPixmapProvider> s_konqPixmapProviderSd;

View file

@ -44,6 +44,7 @@
#include <QtDBus/QtDBus>
#include <QDir>
#include <QPixmap>
#include <kconfiggroup.h>
/*
Test cases:

View file

@ -30,10 +30,11 @@
#include <QFile>
#include <iostream>
#include <kservicetypetrader.h>
#include <kinstance.h>
#include <kcomponentdata.h>
#include <assert.h>
#include <ksimpleconfig.h>
#include <kconfiggroup.h>
static QPixmap wallpaperPixmap( const QString & _wallpaper )
{
@ -72,15 +73,15 @@ struct KonqPropsView::Private
QString sortcriterion;
};
KonqPropsView::KonqPropsView( KInstance * instance, KonqPropsView * defaultProps )
KonqPropsView::KonqPropsView(const KComponentData &componentData, KonqPropsView *defaultProps)
: m_bSaveViewPropertiesLocally( false ), // will be overridden by setSave... anyway
// if this is the default properties instance, then keep config object for saving
m_dotDirExists( true ), // HACK so that enterDir returns true initially
m_currentConfig( defaultProps ? 0L : instance->config() ),
m_currentConfig( defaultProps ? KSharedConfig::Ptr() : componentData.config() ),
m_defaultProps( defaultProps )
{
KConfig *config = instance->config();
KSharedConfig::Ptr config = componentData.config();
KConfigGroup cgs(config, "Settings");
d = new Private;
@ -147,7 +148,7 @@ bool KonqPropsView::isDescending() const
return d->descending;
}
KConfigBase * KonqPropsView::currentConfig()
KSharedConfigPtr KonqPropsView::currentConfig()
{
if ( !m_currentConfig )
{
@ -156,13 +157,13 @@ KConfigBase * KonqPropsView::currentConfig()
assert ( !isDefaultProperties() );
if (!dotDirectory.isEmpty())
m_currentConfig = new KSimpleConfig( dotDirectory );
m_currentConfig = KSharedConfig::openConfig(dotDirectory);
// the "else" is when we want to save locally but this is a remote URL -> no save
}
return m_currentConfig;
}
KConfigBase * KonqPropsView::currentColorConfig()
KSharedConfigPtr KonqPropsView::currentColorConfig()
{
// Saving locally ?
if ( m_bSaveViewPropertiesLocally && !isDefaultProperties() )
@ -257,7 +258,7 @@ bool KonqPropsView::enterDir( const KUrl & dir )
//if there is or was a .directory then the settings probably have changed
bool configChanged=(m_dotDirExists|| dotDirExists);
m_dotDirExists = dotDirExists;
m_currentConfig = 0L; // new dir, not current config for saving yet
m_currentConfig.clear(); // new dir, not current config for saving yet
//kDebug(1203) << "KonqPropsView::enterDir returning " << configChanged << endl;
return configChanged;
}
@ -267,11 +268,8 @@ void KonqPropsView::setSaveViewPropertiesLocally( bool value )
assert( !isDefaultProperties() );
//kDebug(1203) << "KonqPropsView::setSaveViewPropertiesLocally " << value << endl;
if ( m_bSaveViewPropertiesLocally )
delete m_currentConfig; // points to a KSimpleConfig
m_currentConfig.clear();
m_bSaveViewPropertiesLocally = value;
m_currentConfig = 0L; // mark as dirty
}
void KonqPropsView::setIconSize( int size )
@ -461,7 +459,7 @@ void KonqPropsView::setBgColor( const QColor & color )
}
else
{
KConfigBase * colorConfig = currentColorConfig();
KSharedConfig::Ptr colorConfig = currentColorConfig();
if (colorConfig) // 0L when saving locally but remote URL
{
KConfigGroup cgs(colorConfig, currentGroup());
@ -488,7 +486,7 @@ void KonqPropsView::setTextColor( const QColor & color )
}
else
{
KConfigBase * colorConfig = currentColorConfig();
KSharedConfig::Ptr colorConfig = currentColorConfig();
if (colorConfig) // 0L when saving locally but remote URL
{
KConfigGroup cgs(colorConfig, currentGroup());
@ -516,7 +514,7 @@ void KonqPropsView::setBgPixmapFile( const QString & file )
}
else
{
KConfigBase * colorConfig = currentColorConfig();
KSharedConfig::Ptr colorConfig = currentColorConfig();
if (colorConfig) // 0L when saving locally but remote URL
{
KConfigGroup cgs(colorConfig, currentGroup());

View file

@ -25,10 +25,9 @@
#include <kurl.h>
#include <libkonq_export.h>
#include <kconfig.h>
class KInstance;
class KConfigBase;
class KConfig;
class KComponentData;
/**
* The class KonqPropsView holds the properties for a Konqueror View
@ -51,7 +50,7 @@ public:
* is the one used by a view, and its value can differ from the default ones.
* The instance parameter should be the same for both...
*/
KonqPropsView( KInstance * instance, KonqPropsView * defaultProps /*= 0L*/ );
KonqPropsView(const KComponentData &instance, KonqPropsView *defaultProps /*= 0L*/);
/** Destructor */
virtual ~KonqPropsView();
@ -126,10 +125,10 @@ protected:
QPixmap loadPixmap() const;
// Current config object for _saving_
KConfigBase * currentConfig();
KSharedConfigPtr currentConfig();
// Current config object for _saving_ settings related to colors
KConfigBase * currentColorConfig();
KSharedConfigPtr currentColorConfig();
QString currentGroup() const {
return isDefaultProperties() ?
@ -161,7 +160,7 @@ private:
// It is set to 0L to mark it as "needs to be constructed".
// This is to be used for SAVING only.
// Can be a KConfig or a KSimpleConfig
KConfigBase * m_currentConfig;
KSharedConfigPtr m_currentConfig;
// If this is not a "default properties" instance (but one used by a view)
// then m_defaultProps points to the "default properties" instance

View file

@ -26,6 +26,7 @@
#include <kdebug.h>
#include <assert.h>
#include <QFontMetrics>
#include <kconfiggroup.h>
struct KonqFMSettingsPrivate
{
@ -48,7 +49,7 @@ KonqFMSettings * KonqFMSettings::settings()
{
if (!s_pSettings)
{
KConfig *config = KGlobal::config();
KSharedConfig::Ptr config = KGlobal::config();
KConfigGroup cgs(config, "FMSettings");
s_pSettings = new KonqFMSettings(config);
}
@ -60,16 +61,16 @@ void KonqFMSettings::reparseConfiguration()
{
if (s_pSettings)
{
KConfig *config = KGlobal::config();
KSharedConfig::Ptr config = KGlobal::config();
KConfigGroup cgs(config, "FMSettings");
s_pSettings->init( config );
}
}
KonqFMSettings::KonqFMSettings( KConfig * config )
KonqFMSettings::KonqFMSettings(const KSharedConfigPtr &config)
{
d = new KonqFMSettingsPrivate;
init( config );
init(config);
}
KonqFMSettings::~KonqFMSettings()
@ -77,7 +78,7 @@ KonqFMSettings::~KonqFMSettings()
delete d;
}
void KonqFMSettings::init( KConfig * config )
void KonqFMSettings::init(const KSharedConfigPtr &config)
{
// Fonts and colors
m_standardFont = config->readEntry( "StandardFont", QFont() );

View file

@ -28,6 +28,8 @@ class KConfig;
#include <libkonq_export.h>
class KSharedConfigPtr;
/**
* The class KonqFMSettings holds the general settings for the
* icon/tree views in konqueror/kdesktop.
@ -48,7 +50,7 @@ protected:
* @internal
* Constructs a KonqFMSettings instance from a config file.
*/
KonqFMSettings( KConfig * config );
KonqFMSettings(const KSharedConfigPtr &config);
/** Destructor. Don't delete any instance by yourself. */
virtual ~KonqFMSettings();
@ -128,7 +130,7 @@ private:
int m_iconTransparency;
/** Called by constructor and reparseConfiguration */
void init( KConfig * config );
void init(const KSharedConfigPtr &config);
struct KonqFMSettingsPrivate * d;

View file

@ -116,7 +116,7 @@ extern "C"
* We need one static instance of the factory for our C 'main'
* function
*/
KInstance *PluginFactory::s_instance = 0L;
KComponentData *PluginFactory::s_instance = 0L;
PluginFactory::PluginFactory()
@ -135,11 +135,11 @@ PluginFactory::~PluginFactory()
_loader->release();
if ( s_instance ) {
if (s_instance) {
delete s_instance->aboutData();
delete s_instance;
s_instance = 0;
}
s_instance = 0;
}
KParts::Part * PluginFactory::createPartObject(QWidget *parentWidget, QObject *parent,
@ -152,13 +152,14 @@ KParts::Part * PluginFactory::createPartObject(QWidget *parentWidget, QObject *p
}
KInstance *PluginFactory::instance()
const KComponentData &PluginFactory::componentData()
{
kDebug(1432) << "PluginFactory::instance" << endl;
if ( !s_instance )
s_instance = new KInstance( aboutData() );
return s_instance;
if (!s_instance) {
s_instance = new KComponentData(aboutData());
}
return *s_instance;
}
KAboutData *PluginFactory::aboutData()
@ -179,7 +180,7 @@ PluginPart::PluginPart(QWidget *parentWidget, QObject *parent, const QStringList
(void) new CallBackAdaptor( this );
QDBusConnection::sessionBus().registerObject( s_callBackObjectPath, this );
setInstance(PluginFactory::instance());
setComponentData(PluginFactory::componentData());
kDebug(1432) << "PluginPart::PluginPart" << endl;
// we have to keep the class name of KParts::PluginBrowserExtension

View file

@ -32,7 +32,7 @@
#include <QPointer>
class KAboutData;
class KInstance;
class KComponentData;
class PluginBrowserExtension;
class PluginLiveConnectExtension;
class QLabel;
@ -51,12 +51,12 @@ public:
const char *classname = "KParts::Part",
const QStringList &args = QStringList());
static KInstance *instance();
static const KComponentData &componentData();
static KAboutData *aboutData();
private:
static KInstance *s_instance;
static KComponentData *s_instance;
class NSPluginLoader *_loader;
};