コード例 #1
0
CSSMappedAttributeDeclarationImpl* HTMLElementImpl::getMappedAttributeDecl(MappedAttributeEntry entryType, AttributeImpl* attr)
{
    if (!m_mappedAttributeDecls)
        return 0;
    
    QPtrDict<QPtrDict<CSSMappedAttributeDeclarationImpl> >* attrNameDict = m_mappedAttributeDecls->find((void*)entryType);
    if (attrNameDict) {
        QPtrDict<CSSMappedAttributeDeclarationImpl>* attrValueDict = attrNameDict->find((void*)attr->id());
        if (attrValueDict)
            return attrValueDict->find(attr->value().implementation());
    }
    return 0;
}
コード例 #2
0
ファイル: main.C プロジェクト: xwizard/kde1
void TEDemo::font_menu_activated(int item)
{
  assert(se);
  se->setFontNo(item);
  activateSession((int)session2no.find(se)); // for attribute change
  // setFont(item) is probably enough
}
コード例 #3
0
ファイル: main.C プロジェクト: xwizard/kde1
void TEDemo::schema_menu_activated(int item)
{
  assert(se);
  //FIXME: save schema name
  se->setSchemaNo(item);
  activateSession((int)session2no.find(se)); // for attribute change
  // setSchema(item) is probably enough
}
コード例 #4
0
ファイル: main.C プロジェクト: xwizard/kde1
void TEDemo::runSession(TESession* s)
{
  int session_no = (int)session2no.find(s);
  activateSession(session_no);

  // give some time to get through the
  // resize events before starting up.
  QTimer::singleShot(100,s,SLOT(run()));
}
コード例 #5
0
void HTMLElementImpl::removeMappedAttributeDecl(MappedAttributeEntry entryType, NodeImpl::Id attrName, const AtomicString& attrValue)
{
    if (!m_mappedAttributeDecls)
        return;
    
    QPtrDict<QPtrDict<CSSMappedAttributeDeclarationImpl> >* attrNameDict = m_mappedAttributeDecls->find((void*)entryType);
    if (!attrNameDict)
        return;
    QPtrDict<CSSMappedAttributeDeclarationImpl>* attrValueDict = attrNameDict->find((void*)attrName);
    if (!attrValueDict)
        return;
    attrValueDict->remove(attrValue.implementation());
}
コード例 #6
0
ファイル: main.C プロジェクト: xwizard/kde1
void TEDemo::doneSession(TESession* s, int status)
{
//printf("%s(%d): Exited:%d ExitStatus:%d\n",__FILE__,__LINE__,WIFEXITED(status),WEXITSTATUS(status));
#if 0 // die silently
  if (!WIFEXITED((status)) || WEXITSTATUS((status)))
  {
    QString str;
    //FIXME: "Title" is not a precise locator for the message.
    //       The command would be better.
    str.sprintf(i18n("`%s' terminated abnormally."), s->Title());
    if (WIFEXITED((status)))
    {char rcs[100]; sprintf(rcs,"%d.\n",WEXITSTATUS((status)));
      str = str + i18n("\nReturn code = ") + rcs;
    }
    KMsgBox::message( this, i18n("Error"), str, KMsgBox::EXCLAMATION );
  }
#endif
  int no = (int)session2no.find(s);
  if (!no) return; // oops
  no2session.remove(no);
  session2no.remove(s);
  m_sessions->removeItem(no);

  s->setConnect(FALSE);

  // This slot (doneSession) is activated from the Shell when receiving a
  // SIGCHLD. A lot is done during the signal handler, apparently deleting
  // the Shell additionally, is sometimes too much, causing something
  // to get messed up in rare cases. The following causes delete not to
  // be called from within the signal handler.

  QTimer::singleShot(100,s,SLOT(terminate()));

  if (s == se)
  { // pick a new session
    se = NULL;
    QIntDictIterator<TESession> it( no2session );
    if ( it.current() )
      activateSession(it.currentKey());
    else
      kapp->quit();
  }
}
コード例 #7
0
void HTMLElementImpl::setMappedAttributeDecl(MappedAttributeEntry entryType, AttributeImpl* attr, CSSMappedAttributeDeclarationImpl* decl)
{
    if (!m_mappedAttributeDecls)
        m_mappedAttributeDecls = new QPtrDict<QPtrDict<QPtrDict<CSSMappedAttributeDeclarationImpl> > >;
    
    QPtrDict<CSSMappedAttributeDeclarationImpl>* attrValueDict = 0;
    QPtrDict<QPtrDict<CSSMappedAttributeDeclarationImpl> >* attrNameDict = m_mappedAttributeDecls->find((void*)entryType);
    if (!attrNameDict) {
        attrNameDict = new QPtrDict<QPtrDict<CSSMappedAttributeDeclarationImpl> >;
        attrNameDict->setAutoDelete(true);
        m_mappedAttributeDecls->insert((void*)entryType, attrNameDict);
    }
    else
        attrValueDict = attrNameDict->find((void*)attr->id());
    if (!attrValueDict) {
        attrValueDict = new QPtrDict<CSSMappedAttributeDeclarationImpl>;
        if (entryType == ePersistent)
            attrValueDict->setAutoDelete(true);
        attrNameDict->insert((void*)attr->id(), attrValueDict);
    }
    attrValueDict->replace(attr->value().implementation(), decl);
}
コード例 #8
0
ファイル: main.C プロジェクト: xwizard/kde1
void TEDemo::activateSession(int sn)
{
  TESession* s = no2session.find(sn);
  if (se)
  {
    se->setConnect(FALSE);
    int no = (int)session2no.find(se);
    m_sessions->setItemChecked(no,FALSE);
  }
  se = s;
  if (!s) { fprintf(stderr,"session not found\n"); return; } // oops
  m_sessions->setItemChecked(sn,TRUE);
  setSchema(s->schemaNo());               //FIXME: creates flicker? Do only if differs
//Set Font. Now setConnect should do the appropriate action.
//if the size has changed, a resize event (noticable to the application)
//should happen. Else, we  could even start the application
  s->setConnect(TRUE);                    // does a bulkShow (setImage)
  setFont(s->fontNo());                   //FIXME: creates flicker?
                                          //FIXME: check here if we're still alife.
                                          //       if not, quit, otherwise,
                                          //       start propagating quit.
  title = s->Title(); // take title from current session
  setHeader();
}
コード例 #9
0
bool
ICalReport::generate()
{
#if KDE_IS_VERSION(3,4,89)
    KCal::CalendarLocal cal("UTC");
#else
    KCal::CalendarLocal cal;
#endif

    if( !open())
    {
        tjWarning(i18n("Can not open ICal File '%1' for writing!")
                 .arg(fileName));
        return false;
    }

    TaskList filteredList;
    if (!filterTaskList(filteredList, 0, getHideTask(), getRollUpTask()))
        return false;

    // Make sure that parents are in front of childs. We need this later to set
    // the relation.
    filteredList.setSorting(CoreAttributesList::TreeMode, 0);
    filteredList.setSorting(CoreAttributesList::StartUp, 1);
    sortTaskList(filteredList);

    ResourceList filteredResourceList;
    if (!filterResourceList(filteredResourceList, 0, hideResource,
                            rollUpResource))
        return false;
    sortResourceList(filteredResourceList);

    QPtrDict<KCal::Todo> toDoDict;
    QPtrDict<KCal::Event> eventDict;
    for (TaskListIterator tli(filteredList); *tli != 0; ++tli)
    {
        // Generate a TODO item for each task.
        KCal::Todo* todo = generateTODO(*tli, filteredResourceList);

        // In case we have the parent in the list set the relation pointer.
        if((*tli)->getParent() && toDoDict.find((*tli)->getParent()))
            todo->setRelatedTo(toDoDict[(*tli)->getParent()]);

        // Insert the just created TODO into the calendar.
        cal.addTodo(todo);

        // Insert the TODO into the dict. We might need it as a parent.
        toDoDict.insert(*tli, todo);

        if ((*tli)->isLeaf() && !(*tli)->isMilestone())
        {
            // Generate an event item for each task.
            KCal::Event* event = generateEvent(*tli, filteredResourceList);

            // In case we have the parent in the list set the relation pointer.
            if((*tli)->getParent() && eventDict.find((*tli)->getParent()))
                event->setRelatedTo(eventDict[(*tli)->getParent()]);

            // Insert the just created EVENT into the calendar.
            cal.addEvent(event);

            // Insert the EVENT into the dict. We might need it as a parent.
            eventDict.insert(*tli, event);
        }
    }

    // Dump the calendar in ICal format into a text file.
    KCal::ICalFormat format;
    s << format.toString(&cal) << endl;

    return close();
}
コード例 #10
0
ファイル: qwhatsthis.cpp プロジェクト: kthxbyte/Qt1.45-Linaro
bool QWhatsThisPrivate::eventFilter( QObject * o, QEvent * e )
{
    if ( !o || !e )
	return FALSE;

    switch( state ) {
    case FinalPress:
	if( e->type() == Event_MouseButtonRelease ) {
	    state = Inactive;
	    qApp->removeEventFilter( this );
	    if ( whatsThat )
		whatsThat->hide();
	    return TRUE;
	} else if ( e->type() == Event_MouseMove ) {
	    return TRUE;
	}
	break;
    case Displaying:
	if ( e->type() == Event_MouseButtonPress ) {
	    if ( !qstrcmp( "QWhatsThisPrivate::Button", o->className() ) ) {
		state = Inactive;
		qApp->removeEventFilter( this );
	    } else {
		state = FinalPress;
	    }
	    if ( whatsThat )
		whatsThat->hide();
	    return TRUE;
	} else if ( e->type() == Event_MouseButtonRelease ||
		    e->type() == Event_MouseMove ) {
	    return TRUE;
	} else if ( e->type() == Event_Accel ) {
	    if ( whatsThat )
		whatsThat->hide();
	    ((QKeyEvent *)e)->accept();
	    state = Inactive;
	    qApp->removeEventFilter( this );
	} else if ( e->type() == Event_FocusOut ||
		    e->type() == Event_FocusIn ) {
	    if ( whatsThat )
		whatsThat->hide();
	    state = Inactive;
	    qApp->removeEventFilter( this );
	}
	break;
    case Waiting:
	if ( e->type() == Event_MouseButtonPress && o->isWidgetType() ) {
	    QWidget * w = (QWidget *) o;
	    QWhatsThisPrivate::Item * i = 0;
	    while( w && !i ) {
		i = dict->find( w );
		if ( !i )
		    w = w->parentWidget();
	    }
	    QPtrDictIterator<Button> it( *(wt->buttons) );
	    Button * b;
	    while( (b=it.current()) != 0 ) {
		++it;
		b->setOn( FALSE );
	    }
	    if ( i ) {
		state = Displaying;
		say( w, i->s );
	    } else {
		state = FinalPress;
	    }
	    QApplication::restoreOverrideCursor();
	    return TRUE;
	} else if ( e->type() == Event_MouseButtonPress ||
		    e->type() == Event_MouseMove ) {
	    return TRUE;
	} else if (e->type() == Event_Accel ||
		   e->type() == Event_KeyPress ) {
	    QPtrDictIterator<Button> it( *(wt->buttons) );
	    Button * b;
	    while( (b=it.current()) != 0 ) {
		++it;
		b->setOn( FALSE );
	    }
	    QApplication::restoreOverrideCursor();
	    state = Inactive;
	    qApp->removeEventFilter( this );
	}
	break;
    case Inactive:
	if ( e->type() == Event_Accel &&
	     ((QKeyEvent *)e)->key() == Key_F1 &&
	     !o->parent() &&
	     o->isWidgetType() &&
	     ((QKeyEvent *)e)->state() == ShiftButton ) {
	    QWidget * w = ((QWidget *)o)->focusWidget();
	    QWhatsThisPrivate::Item * i = 0;
	    if ( w && (i=dict->find( w )) != 0 && i->s ) {
		say( w, i->s );
		state = Displaying;
		qApp->installEventFilter( this );
		((QKeyEvent *)e)->accept();
		return TRUE;
	    }
	}
	break;
    }
    return FALSE;
}