Commit 4f29f249 authored by Matthias Kretz's avatar Matthias Kretz
Browse files

merge the kinstance-redesign branch back to trunk.

svn path=/trunk/KDE/kdebase/konqueror/; revision=628276
parent 4df3f545
......@@ -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);
......
......@@ -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 */);
......
......@@ -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");
}
/* -------------------------- */
......
......@@ -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 ) );
......
......@@ -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);
}
......
......@@ -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()
......
......@@ -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;
};
......
......@@ -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);
}
/*
......
......@@ -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() );
......
......@@ -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" );
......
......@@ -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;
......
......@@ -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));
......
......@@ -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;
......
......@@ -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 );
}
......
......@@ -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 )
......
......@@ -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.
......
......@@ -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
......
......@@ -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:
......
......@@ -19,7 +19,6 @@
#include <kparts/plugin.h>
class KUrl;
class KInstance;
/**
* KHTML KParts Plugin
......
......@@ -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()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment