Ejemplo n.º 1
0
ProxyWidget *DockContainer::loadModule(ConfigModule *module)
{
    QApplication::setOverrideCursor(waitCursor);

    ProxyWidget *widget = _modulew->load(module);

    if(widget)
    {
        _module = module;
        connect(_module, SIGNAL(childClosed()), SLOT(removeModule()));
        connect(_module, SIGNAL(changed(ConfigModule *)), SIGNAL(changedModule(ConfigModule *)));
        connect(widget, SIGNAL(quickHelpChanged()), SLOT(quickHelpChanged()));

        raiseWidget(_modulew);
        emit newModule(widget->caption(), module->docPath(), widget->quickHelp());
    }
    else
    {
        raiseWidget(_basew);
        emit newModule(_basew->caption(), "", "");
    }

    QApplication::restoreOverrideCursor();

    return widget;
}
Ejemplo n.º 2
0
KCModule * KCModuleProxy::realModule() const
{

	/*
	 * Note, don't call any function that calls realModule() since
	 * that leads to an infinite loop.
	 */

	kdDebug(711) << k_funcinfo << endl;

	/* Already loaded */
	if( d->kcm )
		return d->kcm;

	/* /We/ have no kcm, but kcmshell running with root prevs does.. */
	if( d->rootMode )
		return 0;

	QApplication::setOverrideCursor( Qt::WaitCursor );
	
	KCModuleProxy * that = const_cast<KCModuleProxy*>( this );

	if( !d->isInitialized )
	{
  		d->dcopName = moduleInfo().handle().prepend("KCModuleProxy-").utf8();
		d->topLayout = new QVBoxLayout( that, 0, 0, "topLayout" );

		d->isInitialized = true;
	}

	if( !d->dcopClient )
		d->dcopClient = new DCOPClient();

	if( !d->dcopClient->isRegistered() )
  		d->dcopClient->registerAs( d->dcopName, false );

	d->dcopClient->setAcceptCalls( true );

	if( d->dcopClient->appId() == d->dcopName || d->bogusOccupier )
	{ /* We got the name we requested, because no one was before us, 
	   * or, it was an random application which had picked that name */
		kdDebug(711) << "Module not already loaded, loading module" << endl;

		d->dcopObject = new KCModuleProxyIfaceImpl( d->dcopName, that );

		d->kcm = KCModuleLoader::loadModule( moduleInfo(), KCModuleLoader::Inline, d->withFallback,
			that, name(), d->args );

		connect( d->kcm, SIGNAL( changed( bool ) ),
				SLOT(moduleChanged(bool)) );
		connect( d->kcm, SIGNAL( destroyed() ),
				SLOT( moduleDestroyed() ) );
		connect( d->kcm, SIGNAL(quickHelpChanged()), 
				SIGNAL(quickHelpChanged()));
		QWhatsThis::add( that, d->kcm->quickHelp() );

		d->topLayout->addWidget( d->kcm );

		if ( !d->rootInfo && /* If it's already done */
				moduleInfo().needsRootPrivileges() /* root, anyone? */ && 
				!KUser().isSuperUser() ) /* Not necessary if we're root */
		{

			d->rootInfo = new QLabel( that, "rootInfo" );
			d->topLayout->insertWidget( 0, d->rootInfo );

			d->rootInfo->setFrameShape(QFrame::Box);
			d->rootInfo->setFrameShadow(QFrame::Raised);

			const QString msg = d->kcm->rootOnlyMsg();
			if( msg.isEmpty() )
				d->rootInfo->setText(i18n(
   					  "<b>Changes in this section requires root access.</b><br />"
					  "Click the \"Administrator Mode\" button to "
					  "allow modifications."));
			else
				d->rootInfo->setText(msg);

			QWhatsThis::add( d->rootInfo, i18n(
				  "This section requires special permissions, probably "
				  "for system-wide changes; therefore, it is "
				  "required that you provide the root password to be "
				  "able to change the module's properties. If "
				  "you do not provide the password, the module will be "
				  "disabled."));
		}
	}
Ejemplo n.º 3
0
KCModuleProxyIfaceImpl::KCModuleProxyIfaceImpl(const QCString &name, KCModuleProxy *const client)
    : DCOPObject(name), QObject(0, name), p(const_cast< KCModuleProxy * >(client))
{
    connect(p, SIGNAL(changed(bool)), SLOT(changedRelay(bool)));
    connect(p, SIGNAL(quickHelpChanged()), SLOT(quickHelpRelay()));
}
Ejemplo n.º 4
0
void KCModule::setQuickHelp(const QString &help)
{
    d->_quickHelp = help;
    emit(quickHelpChanged());
}