Esempio n. 1
0
void
KdmItem::widgetGone()
{
    myWidget = 0;

    emit needPlugging();
    emit needPlacement();
}
Esempio n. 2
0
void
KdmItem::setWidget(QWidget *widget)
{
    if ((myWidget = widget)) {
        myWidget->hide(); // yes, really
        connect(myWidget, SIGNAL(destroyed()), SLOT(widgetGone()));
        setWidgetAttribs(myWidget);
    }

    emit needPlugging();
    emit needPlacement();
}
Esempio n. 3
0
void
KdmLabel::setCText( const QString &txt )
{
	delete action;
	action = 0;
	pText = cText = txt;
	pAccelOff = txt.indexOf( '_' );
	if (pAccelOff >= 0) {
		action = new QAction( this );
		action->setShortcut( Qt::ALT + txt[pAccelOff + 1].unicode() );
		connect( action, SIGNAL(triggered( bool )), SLOT(activate()) );
		emit needPlugging();
		pText.remove( pAccelOff, 1 );
	}
}
Esempio n. 4
0
void
KdmThemer::generateItems( KdmItem *parent, const QDomNode &node )
{
	/*
	 * Go through each of the child nodes
	 */
	const QDomNodeList &subnodeList = node.childNodes();
	for (int nod = 0; nod < subnodeList.count(); nod++) {
		QDomNode subnode = subnodeList.item( nod );
		QDomElement el = subnode.toElement();
		QString tagName = el.tagName();

		if (tagName == "item") {
			QString showType;
			bool showTypeInvert = false;

			QDomNode showNode = subnode.namedItem( "show" );
			if (!showNode.isNull()) {
				QDomElement sel = showNode.toElement();

				QString modes = sel.attribute( "modes" );
				if (!modes.isNull() &&
				    (modes == "nowhere" ||
				     (modes != "everywhere" &&
				      !modes.split( ",", QString::SkipEmptyParts ).contains(
				          m_currentMode ))))
					continue;

				showType = sel.attribute( "type" );
				if (!showType.isNull()) {
					if (showType[0] == '!') {
						showType.remove( 0, 1 );
						showTypeInvert = true;
					}
					if (!showType.startsWith( "plugin-" ) &&
					    m_showTypes.contains( showType ) == showTypeInvert)
						continue;
				}
			}

			QString type = el.attribute( "type" );
			KdmItem *newItem;
			if (type == "label")
				newItem = new KdmLabel( parent, subnode );
			else if (type == "pixmap")
				newItem = new KdmPixmap( parent, subnode );
			else if (type == "rect")
				newItem = new KdmRect( parent, subnode );
			else if (type == "entry") {
				//newItem = new KdmEntry( parent, subnode );
				newItem = new KdmRect( parent, subnode );
				newItem->setType( type );
			} else if (type=="list")
				newItem = new KdmList( parent, subnode );
			else if (type == "svg")
				newItem = new KdmPixmap( parent, subnode );
			else
				continue;
			newItem->setIsButton( el.attribute( "button", "false" ) == "true" );
			newItem->setShowType( showType, showTypeInvert );
			connect( newItem, SIGNAL(needUpdate( int, int, int, int )),
			         SLOT(update( int, int, int, int )) );
			connect( newItem, SIGNAL(needPlacement()),
			         SLOT(slotNeedPlacement()) );
			connect( newItem, SIGNAL(needPlugging()),
			         SLOT(slotNeedPlugging()) );
			connect( newItem, SIGNAL(activated( const QString & )),
			         SIGNAL(activated( const QString & )) );
			generateItems( newItem, subnode );
		} else if (tagName == "box") {
			parent->setBoxLayout( subnode );
			generateItems( parent, subnode );
		} else if (tagName == "fixed") {
			parent->setFixedLayout( subnode );
			generateItems( parent, subnode );
		}
	}
}