void cScriptManager::setCommandHook( const QCString& command, PyObject* object )
{
	if ( commandhooks.contains( command.lower() ) )
	{
		Py_DECREF( commandhooks[command.lower()] );
	}

	commandhooks.replace( command.lower(), object );
}
예제 #2
0
bool VhdlParser::addLibUseClause(const QCString &type)
{
  static bool showIEEESTD=Config_getBool("FORCE_LOCAL_INCLUDES");

  if (showIEEESTD) // all standard packages and libraries will not be shown
  {
    if (type.lower().stripPrefix("ieee")) return FALSE;
    if (type.lower().stripPrefix("std")) return FALSE;
  }
  return TRUE;
}
예제 #3
0
QCString UmlOperation::compute_name() {
  QCString get_set_spec = javaNameSpec();
  
  if (! get_set_spec.isEmpty()) {
    UmlClassMember * it;
    
    if ((it = getOf()) == 0)
      it = setOf();
    
    int index;
    QCString s = (it->kind() == aRelation)
      ? ((UmlRelation *) it)->roleName()
      : it->name();
    
    if ((index = get_set_spec.find("${name}")) != -1)
      get_set_spec.replace(index, 7, s);
    else if ((index = get_set_spec.find("${Name}")) != -1)
      get_set_spec.replace(index, 7, capitalize(s));
    else if ((index = s.find("${NAME}")) != -1)
      get_set_spec.replace(index, 7, s.upper());
    else if ((index = s.find("${nAME}")) != -1)
      get_set_spec.replace(index, 7, s.lower());
    
    return get_set_spec;
  }
  else
    return name();
}
예제 #4
0
static
const char * staticCharset(int i)
{
    static QCString localcharset;

    switch ( i ) {
      case 0:
	return "UTF-8";
      case 1:
	return "ISO-10646-UCS-2";
      case 2:
	return ""; // in the 3rd place - some Xdnd targets might only look at 3
      case 3:
	if ( localcharset.isNull() ) {
	    QTextCodec *localCodec = QTextCodec::codecForLocale();
	    if ( localCodec ) {
		localcharset = localCodec->name();
		localcharset = localcharset.lower();
		stripws(localcharset);
	    } else {
		localcharset = "";
	    }
	}
	return localcharset;
    }
    return 0;
}
예제 #5
0
bool KGlobalSettings::isMultiHead()
{
#ifdef Q_WS_WIN
    return GetSystemMetrics(SM_CMONITORS) > 1;
#else
    QCString multiHead = getenv("KDE_MULTIHEAD");
    if (!multiHead.isEmpty()) {
        return (multiHead.lower() == "true");
    }
    return false;
#endif
}
예제 #6
0
/*!
  Returns TRUE if the information in \a e can be decoded into an image.
  \sa decode()
*/
bool QImageDrag::canDecode( const QMimeSource* e )
{
    QStrList fileFormats = QImageIO::inputFormats();
    fileFormats.first();
    while ( fileFormats.current() ) {
	QCString format = fileFormats.current();
	QCString type = "image/" + format.lower();
	if ( e->provides( type.data() ) )
	    return TRUE;
	fileFormats.next();
    }
    return FALSE;
}
예제 #7
0
/*!
  \reimp
*/
const char * QImageDrag::format(int i) const
{
    if ( i < (int)ofmts.count() ) {
	static QCString str;
	str.sprintf("image/%s",(((QImageDrag*)this)->ofmts).at(i));
	str = str.lower();
	if ( str == "image/pbmraw" )
	    str = "image/ppm";
	return str;
    } else {
	return 0;
    }
}
예제 #8
0
    void setSubType(const QCString & st)
    {
	subtype = st.lower();
	for ( int i=0; i<nfmt; i++ ) {
	    fmt[i] = "text/";
	    fmt[i].append(subtype);
	    QCString cs = staticCharset(i);
	    if ( !cs.isEmpty() ) {
		fmt[i].append(";charset=");
		fmt[i].append(cs);
	    }
	}
    }
예제 #9
0
/*!
  Attempts to decode the dropped information in \a e
  into \a img, returning TRUE if successful.

  \sa canDecode()
*/
bool QImageDrag::decode( const QMimeSource* e, QImage& img )
{
    QByteArray payload;
    QStrList fileFormats = QImageIO::inputFormats();
    // PNG is best of all
    if ( fileFormats.remove("PNG") ) // move to front
	fileFormats.insert(0,"PNG");
    fileFormats.first();
    while ( fileFormats.current() ) {
	QCString format = fileFormats.current();
	QCString type = "image/" + format.lower();
	payload = e->encodedData( type.data() );
	if ( !payload.isEmpty() )
	    break;
	fileFormats.next();
    }

    if ( payload.isEmpty() )
	return FALSE;

    img.loadFromData(payload);
    return !img.isNull();
}
예제 #10
0
extern "C" KDE_EXPORT int kdemain(int argc, char **argv)
{
    {
        QCString multiHead = getenv("KDE_MULTIHEAD");
        if(multiHead.lower() == "true")
        {
            Display *dpy = XOpenDisplay(NULL);
            if(!dpy)
            {
                fprintf(stderr, "%s: FATAL ERROR: couldn't open display %s\n", argv[0], XDisplayName(NULL));
                exit(1);
            }

            int number_of_screens = ScreenCount(dpy);
            kicker_screen_number = DefaultScreen(dpy);
            int pos;
            QCString display_name = XDisplayString(dpy);
            XCloseDisplay(dpy);
            dpy = 0;

            if((pos = display_name.findRev('.')) != -1)
                display_name.remove(pos, 10);

            QCString env;
            if(number_of_screens != 1)
            {
                for(int i = 0; i < number_of_screens; i++)
                {
                    if(i != kicker_screen_number && fork() == 0)
                    {
                        kicker_screen_number = i;
                        // break here because we are the child process, we don't
                        // want to fork() anymore
                        break;
                    }
                }

                env.sprintf("DISPLAY=%s.%d", display_name.data(), kicker_screen_number);

                if(putenv(strdup(env.data())))
                {
                    fprintf(stderr, "%s: WARNING: unable to set DISPLAY environment variable\n", argv[0]);
                    perror("putenv()");
                }
            }
        }
    }

    KGlobal::locale()->setMainCatalogue("kicker");

    QCString appname;
    if(kicker_screen_number == 0)
        appname = "kicker";
    else
        appname.sprintf("kicker-screen-%d", kicker_screen_number);

    KAboutData aboutData(appname.data(), I18N_NOOP("KDE Panel"), version, description, KAboutData::License_BSD,
                         I18N_NOOP("(c) 1999-2004, The KDE Team"));

    aboutData.addAuthor("Aaron J. Seigo", I18N_NOOP("Current maintainer"), "*****@*****.**");
    aboutData.addAuthor("Matthias Elter", 0, "*****@*****.**");
    aboutData.addAuthor("Matthias Ettrich", 0, "*****@*****.**");
    aboutData.addAuthor("Wilco Greven", 0, "*****@*****.**");
    aboutData.addAuthor("Rik Hemsley", 0, "*****@*****.**");
    aboutData.addAuthor("Daniel M. Duley", 0, "*****@*****.**");
    aboutData.addAuthor("Preston Brown", 0, "*****@*****.**");
    aboutData.addAuthor("John Firebaugh", 0, "*****@*****.**");
    aboutData.addAuthor("Waldo Bastian", I18N_NOOP("Kiosk mode"), "*****@*****.**");

    aboutData.addCredit("Jessica Hall", /* I18N_NOOP("KConfigXT") */ 0, "*****@*****.**");
    aboutData.addCredit("Stefan Nikolaus", /* I18N_NOOP("Bug fixes") */ 0, "*****@*****.**");
    aboutData.addCredit("Benoît Minisini", /* I18N_NOOP("Bug fixes") */ 0, "*****@*****.**");
    KCmdLineArgs::init(argc, argv, &aboutData);

    if(!Kicker::start())
    {
        kdError() << "kicker is already running!" << endl;
        return 0;
    }

    if(signal(SIGTERM, sighandler) == SIG_IGN)
        signal(SIGTERM, SIG_IGN);
    if(signal(SIGINT, sighandler) == SIG_IGN)
        signal(SIGINT, SIG_IGN);
    if(signal(SIGHUP, sighandler) == SIG_IGN)
        signal(SIGHUP, SIG_IGN);

    // send it even before KApplication ctor, because ksmserver will launch another app as soon
    // as QApplication registers with it
    DCOPClient *cl = new DCOPClient;
    cl->attach();
    DCOPRef r("ksmserver", "ksmserver");
    r.setDCOPClient(cl);
    r.send("suspendStartup", QCString("kicker"));
    delete cl;
    Kicker *kicker = new Kicker;
    int rv = kicker->exec();
    delete kicker;
    return rv;
}
예제 #11
0
FileDef *findFileDef(const FileNameDict *fnDict,const char *n,bool &ambig)
{
  ambig=FALSE;
  if (n==0) return 0;

  const int maxAddrSize = 20;
  char addr[maxAddrSize];
  qsnprintf(addr,maxAddrSize,"%p:",fnDict);
  QCString key = addr;
  key+=n;

  g_findFileDefCache.setAutoDelete(TRUE);
  FindFileCacheElem *cachedResult = g_findFileDefCache.find(key);
  //printf("key=%s cachedResult=%p\n",key.data(),cachedResult);
  if (cachedResult)
  {
    ambig = cachedResult->isAmbig;
    //printf("cached: fileDef=%p\n",cachedResult->fileDef);
    return cachedResult->fileDef;
  }
  else
  {
    cachedResult = new FindFileCacheElem(0,FALSE);
  }

  QCString name=QDir::cleanDirPath(n).utf8();
  QCString path;
  int slashPos;
  FileName *fn;
  if (name.isEmpty()) goto exit;
  slashPos=QMAX(name.findRev('/'),name.findRev('\\'));
  if (slashPos!=-1)
  {
    path=name.left(slashPos+1);
    name=name.right(name.length()-slashPos-1); 
    //printf("path=%s name=%s\n",path.data(),name.data());
  }
  if (name.isEmpty()) goto exit;
  if ((fn=(*fnDict)[name]))
  {
    //printf("fn->count()=%d\n",fn->count());
    if (fn->count()==1)
    {
      FileDef *fd = fn->getFirst();
#if defined(_WIN32) || defined(__MACOSX__) // Windows or MacOSX
      bool isSamePath = fd->getPath().right(path.length()).lower()==path.lower();
#else // Unix
      bool isSamePath = fd->getPath().right(path.length())==path;
#endif
      if (path.isEmpty() || isSamePath)
      {
        cachedResult->fileDef = fd;
        g_findFileDefCache.insert(key,cachedResult);
        //printf("=1 ===> add to cache %p\n",fd);
        return fd;
      }
    }
    else // file name alone is ambiguous
    {
      int count=0;
      FileNameIterator fni(*fn);
      FileDef *fd;
      FileDef *lastMatch=0;
      QCString pathStripped = path;
      for (fni.toFirst();(fd=fni.current());++fni)
      {
        QCString fdStripPath = fd->getPath();
        if (path.isEmpty() || fdStripPath.right(pathStripped.length())==pathStripped) 
        { 
          count++; 
          lastMatch=fd; 
        }
      }
      //printf(">1 ===> add to cache %p\n",fd);

      ambig=(count>1);
      cachedResult->isAmbig = ambig;
      cachedResult->fileDef = lastMatch;
      g_findFileDefCache.insert(key,cachedResult);
      return lastMatch;
    }
  }
  else
  {
    //printf("not found!\n");
  }
exit:
  //printf("0  ===> add to cache %p: %s\n",cachedResult,n);
  g_findFileDefCache.insert(key,cachedResult);
  //delete cachedResult;
  return 0;
}
예제 #12
0
void KCGlobal::setType(const QCString& s)
{
  QString string = s.lower();
  _types = QStringList::split(',', string);
}
예제 #13
0
extern "C" KDE_EXPORT int kdemain(int argc, char *argv[])
{
    bool restored = false;
    for(int arg = 1; arg < argc; arg++)
    {
        if(!qstrcmp(argv[arg], "-session"))
        {
            restored = true;
            break;
        }
    }

    if(!restored)
    {
        // we only do the multihead fork if we are not restored by the session
        // manager, since the session manager will register multiple kwins,
        // one for each screen...
        QCString multiHead = getenv("KDE_MULTIHEAD");
        if(multiHead.lower() == "true")
        {

            Display *dpy = XOpenDisplay(NULL);
            if(!dpy)
            {
                fprintf(stderr, "%s: FATAL ERROR while trying to open display %s\n", argv[0], XDisplayName(NULL));
                exit(1);
            }

            int number_of_screens = ScreenCount(dpy);
            KWinInternal::screen_number = DefaultScreen(dpy);
            int pos; // temporarily needed to reconstruct DISPLAY var if multi-head
            QCString display_name = XDisplayString(dpy);
            XCloseDisplay(dpy);
            dpy = 0;

            if((pos = display_name.findRev('.')) != -1)
                display_name.remove(pos, 10); // 10 is enough to be sure we removed ".s"

            QCString envir;
            if(number_of_screens != 1)
            {
                for(int i = 0; i < number_of_screens; i++)
                {
                    // if execution doesn't pass by here, then kwin
                    // acts exactly as previously
                    if(i != KWinInternal::screen_number && fork() == 0)
                    {
                        KWinInternal::screen_number = i;
                        // break here because we are the child process, we don't
                        // want to fork() anymore
                        break;
                    }
                }
                // in the next statement, display_name shouldn't contain a screen
                //   number. If it had it, it was removed at the "pos" check
                envir.sprintf("DISPLAY=%s.%d", display_name.data(), KWinInternal::screen_number);

                if(putenv(strdup(envir.data())))
                {
                    fprintf(stderr, "%s: WARNING: unable to set DISPLAY environment variable\n", argv[0]);
                    perror("putenv()");
                }
            }
        }
    }

    KGlobal::locale()->setMainCatalogue("kwin");

    KAboutData aboutData("kwin", I18N_NOOP("KWin"), version, description, KAboutData::License_GPL, I18N_NOOP("(c) 1999-2005, The KDE Developers"));
    aboutData.addAuthor("Matthias Ettrich", 0, "*****@*****.**");
    aboutData.addAuthor("Cristian Tibirna", 0, "*****@*****.**");
    aboutData.addAuthor("Daniel M. Duley", 0, "*****@*****.**");
    aboutData.addAuthor("Luboš Luňák", I18N_NOOP("Maintainer"), "*****@*****.**");

    KCmdLineArgs::init(argc, argv, &aboutData);
    KCmdLineArgs::addCmdLineOptions(args);

    if(signal(SIGTERM, KWinInternal::sighandler) == SIG_IGN)
        signal(SIGTERM, SIG_IGN);
    if(signal(SIGINT, KWinInternal::sighandler) == SIG_IGN)
        signal(SIGINT, SIG_IGN);
    if(signal(SIGHUP, KWinInternal::sighandler) == SIG_IGN)
        signal(SIGHUP, SIG_IGN);

    KApplication::disableAutoDcopRegistration();
    KWinInternal::Application a;
    KWinInternal::SessionManaged weAreIndeed;
    KWinInternal::SessionSaveDoneHelper helper;

    fcntl(ConnectionNumber(qt_xdisplay()), F_SETFD, 1);

    QCString appname;
    if(KWinInternal::screen_number == 0)
        appname = "kwin";
    else
        appname.sprintf("kwin-screen-%d", KWinInternal::screen_number);

    DCOPClient *client = a.dcopClient();
    client->registerAs(appname.data(), false);
    client->setDefaultObject("KWinInterface");

    return a.exec();
}
예제 #14
0
QString Driver::propertyCaption( const QCString& propName ) const
{
	return d->propertyCaptions[propName.lower()];
}
예제 #15
0
QVariant Driver::propertyValue( const QCString& propName ) const
{
	return d->properties[propName.lower()];
}