Exemple #1
0
void TDECModuleInfo::init(KService::Ptr s)
{
  _allLoaded = false;
  d = new TDECModuleInfoPrivate;

  if ( s )
    _service = s;
  else
  {
    kdDebug(712) << "Could not find the service." << endl;
    return;
  }

  // set the modules simple attributes
  setName(_service->name());
  setComment(_service->comment());
  setIcon(_service->icon());

  _fileName = ( _service->desktopEntryPath() );

  // library and factory
  setLibrary(_service->library());

  // get the keyword list
  setKeywords(_service->keywords());
}
int
Check_FragMesg(FragMesg   *frg_mesg,
               int         assembler) {
  int  failed = 0;
  int  seqLen = 0;

  if (frg_mesg->action == AS_ADD)
    gkpStore->inf.frgInput++;

  if (frg_mesg->action == AS_IGNORE)
    return 0;

  if (isspacearray == NULL) {
    isspacearray    = AS_UTL_getSpaceArray();
    isValidACGTN    = AS_UTL_getValidACGTN();
  }

  if (frg_mesg->action == AS_ADD) {
    failed |= updateLibraryCache(frg_mesg);
    failed |= checkSequenceAndQuality(frg_mesg, &seqLen);
    failed |= checkClearRanges(frg_mesg, seqLen, assembler);
    failed |= setLibrary(frg_mesg);
    failed |= setUID(frg_mesg);

    if (failed) {
      AS_GKP_reportError(AS_GKP_FRG_LOADED_DELETED, 0,
                         AS_UID_toString(frg_mesg->eaccession));
      gkFrag1->gkFragment_setIsDeleted(1);
    } else {
      gkFrag1->gkFragment_setIsDeleted(0);
    }

    gkpStore->gkStore_addFragment(gkFrag1);

  } else if (frg_mesg->action == AS_DELETE) {
    AS_IID       iid = gkpStore->gkStore_getUIDtoIID(frg_mesg->eaccession, NULL);

    if (iid == 0) {
      AS_GKP_reportError(AS_GKP_FRG_DOESNT_EXIST, 0,
                         AS_UID_toString(frg_mesg->eaccession));
      return(1);
    }

    gkpStore->gkStore_getFragment(iid, gkFrag1, GKFRAGMENT_INF);

    if (gkFrag1->gkFragment_getMateIID() > 0) {
      AS_GKP_reportError(AS_GKP_FRG_HAS_MATE, 0,
                         AS_UID_toString(frg_mesg->eaccession));
      return(1);
    }

    gkpStore->gkStore_delFragment(iid);

  } else {
    AS_GKP_reportError(AS_GKP_FRG_UNKNOWN_ACTION, 0);
    return 1;
  }

  return(failed);
}
Exemple #3
0
AppletInfo::AppletInfo(const QString &deskFile, const QString &configFile, const AppletInfo::AppletType type)
    : m_type(type), m_unique(true), m_hidden(false)
{
    QFileInfo fi(deskFile);
    m_desktopFile = fi.fileName();

    const char *resource = "applets";
    switch(type)
    {
        case Extension:
            resource = "extensions";
            break;
        case BuiltinButton:
            resource = "builtinbuttons";
            break;
        case SpecialButton:
            resource = "specialbuttons";
            break;
        case Undefined:
        case Applet:
        default:
            break;
    }

    KDesktopFile df(m_desktopFile, true, resource);

    // set the appletssimple attributes
    setName(df.readName());
    setComment(df.readComment());
    setIcon(df.readIcon());

    // library
    setLibrary(df.readEntry("X-KDE-Library"));

    // is it a unique applet?
    setIsUnique(df.readBoolEntry("X-KDE-UniqueApplet", false));

    // should it be shown in the gui?
    m_hidden = df.readBoolEntry("Hidden", false);

    if(configFile.isEmpty())
    {
        // generate a config file base name from the library name
        m_configFile = m_lib.lower();

        if(m_unique)
        {
            m_configFile.append("rc");
        }
        else
        {
            m_configFile.append("_").append(kapp->randomString(20).lower()).append("_rc");
        }
    }
    else
    {
        m_configFile = configFile;
    }
}
ExtensionInfo::ExtensionInfo( const QString& deskFile, const QString& configFile, const ExtensionInfo::ExtensionType type)
{
    d = new Private;
    d->type = type;
    QFileInfo fi(deskFile);
    d->desktopFilePath = fi.absoluteFilePath();
    d->desktopFile = fi.fileName();

    KDesktopFile df(deskFile);

    // set the appletssimple attributes
    setName(df.readName());
    setComment(df.readComment());
    setIcon(df.readIcon());

    // library
    setLibrary(df.desktopGroup().readEntry("X-KDE-Library"));

    // is it a unique applet?
    setIsUnique(df.desktopGroup().readEntry("X-KDE-UniqueExtension", false));

    // should it be shown in the gui?
    d->hidden = df.desktopGroup().readEntry("Hidden", false);

    if (configFile.isEmpty())
    {
        // generate a config file base name from the library name
        d->configFile = d->lib.toLower();

        if (d->unique)
        {
            d->configFile.append("rc");
        }
        else
        {
            d->configFile.append("_")
                        .append(KRandom::randomString(20).toLower())
                        .append("_rc");
        }
    }
    else
    {
        d->configFile = configFile;
    }
}