Пример #1
0
void Small::saveInstance(){
  QCString store;
  QCString temp;
  store.append("MAX_CID=");
  store.append(w->spinBox2->text());
  store.append("\nMRRU=");
  store.append(w->spinBox3->text());
  store.append("\nLARGE_CID=");
  if(w->checkBox1->isChecked())
    store.append("YES");
  else
    store.append("NO");
  store.append("\nCONNECTION_TYPE=");
//  store.append(w->comboBox1->text(w->comboBox1->currentItem()));
//  temp = new QCString();
//  temp = w->comboBox1->currentItem();
  temp.setNum(w->comboBox1->currentItem());
  store.append(temp);
  store.append("\nFEEDBACK_FREQ=");
  temp.setNum(w->slider2->value());
  store.append(temp);

  store.append("\nROHC_ENABLE=");
  if(w->checkBox2->isChecked())
    store.append("YES\n");
  else
    store.append("NO\n");

//  KMessageBox::information(this, store);
  editMode(false);
  w->pushButton2_2->setOn(false);
  object->writeProc(store);  
}
Пример #2
0
void KConfigBase::writeEntry(const char *pKey, const QSize &rSize, bool bPersistent, bool bGlobal, bool bNLS)
{
    QStrList list;
    QCString tempstr;
    list.insert(0, tempstr.setNum(rSize.width()));
    list.insert(1, tempstr.setNum(rSize.height()));

    writeEntry(pKey, list, ',', bPersistent, bGlobal, bNLS);
}
Пример #3
0
void KConfigBase::writeEntry(const char *pKey, const QRect &rRect, bool bPersistent, bool bGlobal, bool bNLS)
{
    QStrList list;
    QCString tempstr;
    list.insert(0, tempstr.setNum(rRect.left()));
    list.insert(1, tempstr.setNum(rRect.top()));
    list.insert(2, tempstr.setNum(rRect.width()));
    list.insert(3, tempstr.setNum(rRect.height()));

    writeEntry(pKey, list, ',', bPersistent, bGlobal, bNLS);
}
Пример #4
0
QCString KDevSvnd::sslPasswdDlg(QString promptMsg)
{
	QCString passwd;
	int ret = KPasswordDialog::getPassword( passwd,promptMsg );
	if( ret == KPasswordDialog::Accepted ){
		QCString retstr;
		retstr.setNum(1);
		return retstr + passwd;
	} else{
		QCString nullstr;
		nullstr.setNum(-1);
		return nullstr;
	}
}
Пример #5
0
static void format_warn(const char *file,int line,const char *text)
{
  QCString fileSubst = file==0 ? "<unknown>" : file;
  QCString lineSubst; lineSubst.setNum(line);
  QCString textSubst = text;
  QCString versionSubst;
  if (file) // get version from file name
  {
    bool ambig;
    FileDef *fd=findFileDef(Doxygen::inputNameDict,file,ambig);
    if (fd)
    {
      versionSubst = fd->getVersion();
    }
  }
  // substitute markers by actual values
  QCString msgText = 
      substitute(
        substitute(
          substitute(
            substitute( 
              outputFormat,
              "$file",fileSubst
            ),
            "$text",textSubst
          ),
          "$line",lineSubst
        ),
        "$version",versionSubst
      )+'\n';

  // print resulting message
  fwrite(msgText.data(),1,msgText.length(),warnFile);
}
Пример #6
0
void KNNntpClient::doFetchArticle()
{
    KNRemoteArticle *target = static_cast<KNRemoteArticle *>(job->data());
    QCString cmd;

    sendSignal(TSdownloadArticle);
    errorPrefix = i18n("Article could not be retrieved.\nThe following error occurred:\n");

    progressValue = 100;
    predictedLines = target->lines()->numberOfLines() + 10;

    if(target->collection())
    {
        QString groupName = static_cast<KNGroup *>(target->collection())->groupname();
        if(currentGroup != groupName)
        {
            cmd = "GROUP ";
            cmd += groupName.utf8();
            if(!sendCommandWCheck(cmd, 211))       // 211 n f l s group selected
                return;
            currentGroup = groupName;
        }
    }

    if(target->articleNumber() != -1)
    {
        cmd.setNum(target->articleNumber());
        cmd.prepend("ARTICLE ");
    }
    else
    {
        cmd = "ARTICLE " + target->messageID()->as7BitString(false);
    }

    if(!sendCommandWCheck(cmd, 220))        // 220 n <a> article retrieved - head and body follow
    {
        int code = atoi(getCurrentLine());
        if(code == 430 || code == 423)      // 430 no such article found || 423 no such article number in this group
        {
            QString msgId = target->messageID()->as7BitString(false);
            // strip of '<' and '>'
            msgId = msgId.mid(1, msgId.length() - 2);
            job->setErrorString(errorPrefix + getCurrentLine() +
                                i18n("<br><br>The article you requested is not available on your news server."
                                     "<br>You could try to get it from <a href=\"http://groups.google.com/groups?selm=%1\">groups.google.com</a>.")
                                .arg(msgId));
        }
        return;
    }

    QStrList msg;
    if(!getMsg(msg))
        return;

    progressValue = 1000;
    sendSignal(TSprogressUpdate);

    target->setContent(&msg);
    target->parse();
}
Пример #7
0
void KoXmlWriter::addAttributePt( const char* attrName, double value )
{
    QCString str;
    str.setNum( value, 'g', DBL_DIG );
    str += "pt";
    addAttribute( attrName, str.data() );
}
Пример #8
0
void UmlClass::html() {
  QCString s;
  
  UmlCom::message(name());
  
  if (stereotype() == "stereotype")
    start_file("stereotype" + s.setNum((unsigned) getIdentifier()), "Stereotype " + name(), TRUE);
  else if (stereotype() == "metaclass")
    start_file("metaclass" + s.setNum((unsigned) getIdentifier()), "Metaclass " + name(), TRUE);
  else
    start_file("class" + s.setNum((unsigned) getIdentifier()), "Class " + name(), TRUE);
  define();
  gen_html("", 0, 0);
  end_file();
  
  unload(FALSE, FALSE);
}
Пример #9
0
void FileIn::warning(QCString s) {
  QCString num;
  QCString warn = QCString("warning in ") + _path + " line " +
    num.setNum(_linenum) + " : " + s + "<br>";
  
  UmlCom::trace(warn);

}
Пример #10
0
QCString ConnectionHandler::makeKey(int _namespace, QCString s1, QCString s2, QCString s3)
{
    QCString res;
    res.setNum(_namespace);
    res += "*";
    res += s1 + "*" + s2 + "*" + s3;
    return res;
}
Пример #11
0
void FileIn::error(QCString s) {
  QCString num;
  QCString err = QCString("error in ") + _path + " line " +
    num.setNum(_linenum) + " : " + s + "<br>";
  
  UmlCom::trace(err);
  throw 0;
}
Пример #12
0
void KConfigBase::writeEntry(const char *pKey, const QPoint &rPoint, bool bPersistent, bool bGlobal, bool bNLS)
{
    QStrList list;
    QCString tempstr;
    list.insert(0, tempstr.setNum(rPoint.x()));
    list.insert(1, tempstr.setNum(rPoint.y()));

    writeEntry(pKey, list, ',', bPersistent, bGlobal, bNLS);
}
Пример #13
0
void KConfigBase::writeEntry(const char *pKey, const QDateTime &rDateTime, bool bPersistent, bool bGlobal, bool bNLS)
{
    QStrList list;
    QCString tempstr;

    QTime time = rDateTime.time();
    QDate date = rDateTime.date();

    list.insert(0, tempstr.setNum(date.year()));
    list.insert(1, tempstr.setNum(date.month()));
    list.insert(2, tempstr.setNum(date.day()));

    list.insert(3, tempstr.setNum(time.hour()));
    list.insert(4, tempstr.setNum(time.minute()));
    list.insert(5, tempstr.setNum(time.second()));

    writeEntry(pKey, list, ',', bPersistent, bGlobal, bNLS);
}
Пример #14
0
void ConnectionHandler::sendExitCode()
{
    if(!m_needExitCode)
        return;
    QCString buf;
    buf.setNum(m_exitCode);
    buf.prepend("OK ");
    buf.append("\n");

    send(m_Fd, buf.data(), buf.length(), 0);
}
Пример #15
0
void KJPitchText::timeUpdate(int)
{
	QCString speed;

	if (!napp->player()->current())
		return;

	Arts::PlayObject playobject = napp->player()->engine()->playObject();
	Arts::PitchablePlayObject pitchable = Arts::DynamicCast(playobject);

	if (pitchable.isNull())
		return;

	speed.setNum ( (int) ((float)pitchable.speed()*(float)100) );
	prepareString ( speed );
}
Пример #16
0
static void do_warn(const char *tag, const char *file, int line, const char *fmt, va_list args)
{
  if (!Config_getBool(tag)) return; // warning type disabled
  char text[40960];
  vsprintf(text, fmt, args);
  QCString fileSubst = file==0 ? "<unknown>" : file;
  QCString lineSubst; lineSubst.setNum(line);
  QCString textSubst = text;
  QCString versionSubst;
  if (file) // get version from file name
  {
    bool ambig;
    FileDef *fd=findFileDef(Doxygen::inputNameDict,file,ambig);
    if (fd)
    {
      versionSubst = fd->getVersion();
    }
  }
  // substitute markers by actual values
  QCString msgText = 
    substitute(
      substitute(
        substitute(
          substitute(
            substitute( 
              outputFormat,
              "$file",fileSubst
            ),
            "$text",textSubst
          ),
          "$line",lineSubst
        ),
        "$version",versionSubst
      ),
      "%","%%"
    )+'\n';

  // print resulting message
  fprintf(warnFile,"%s",msgText.data());
}
Пример #17
0
bool KateSession::create(const QString &name, bool force)
{
    if(!force && (name.isEmpty() || !m_sessionFileRel.isEmpty()))
        return false;

    delete m_writeConfig;
    m_writeConfig = 0;

    delete m_readConfig;
    m_readConfig = 0;

    m_sessionName = name;

    // get a usable filename
    int s = time(0);
    QCString tname;
    while(true)
    {
        tname.setNum(s++);
        KMD5 md5(tname);
        m_sessionFileRel = QString("%1.katesession").arg(md5.hexDigest().data());

        if(!KGlobal::dirs()->exists(sessionFile()))
            break;
    }

    // create the file, write name to it!
    KSimpleConfig config(sessionFile());
    config.setGroup("General");
    config.writeEntry("Name", m_sessionName);
    config.sync();

    // reinit ourselfs ;)
    init();

    return true;
}
Пример #18
0
extern "C" KDE_EXPORT int kdemain( int argc, char **argv )
{
  // here we go, construct the Kate version
  QString kateVersion = KateApp::kateVersion();

  KAboutData aboutData ("kate", I18N_NOOP("Kate"), kateVersion.latin1(),
                        I18N_NOOP( "Kate - Advanced Text Editor" ), KAboutData::License_LGPL_V2,
                        I18N_NOOP( "(c) 2000-2005 The Kate Authors" ), 0, "http://kate.kde.org");

  aboutData.addAuthor ("Christoph Cullmann", I18N_NOOP("Maintainer"), "*****@*****.**", "http://www.babylon2k.de");
  aboutData.addAuthor ("Anders Lund", I18N_NOOP("Core Developer"), "*****@*****.**", "http://www.alweb.dk");
  aboutData.addAuthor ("Joseph Wenninger", I18N_NOOP("Core Developer"), "*****@*****.**","http://stud3.tuwien.ac.at/~e9925371");
  aboutData.addAuthor ("Hamish Rodda",I18N_NOOP("Core Developer"), "*****@*****.**");
  aboutData.addAuthor ("Waldo Bastian", I18N_NOOP( "The cool buffersystem" ), "*****@*****.**" );
  aboutData.addAuthor ("Charles Samuels", I18N_NOOP("The Editing Commands"), "*****@*****.**");
  aboutData.addAuthor ("Matt Newell", I18N_NOOP("Testing, ..."), "*****@*****.**");
  aboutData.addAuthor ("Michael Bartl", I18N_NOOP("Former Core Developer"), "*****@*****.**");
  aboutData.addAuthor ("Michael McCallum", I18N_NOOP("Core Developer"), "*****@*****.**");
  aboutData.addAuthor ("Jochen Wilhemly", I18N_NOOP( "KWrite Author" ), "*****@*****.**" );
  aboutData.addAuthor ("Michael Koch",I18N_NOOP("KWrite port to KParts"), "*****@*****.**");
  aboutData.addAuthor ("Christian Gebauer", 0, "*****@*****.**" );
  aboutData.addAuthor ("Simon Hausmann", 0, "*****@*****.**" );
  aboutData.addAuthor ("Glen Parker",I18N_NOOP("KWrite Undo History, Kspell integration"), "*****@*****.**");
  aboutData.addAuthor ("Scott Manson",I18N_NOOP("KWrite XML Syntax highlighting support"), "*****@*****.**");
  aboutData.addAuthor ("John Firebaugh",I18N_NOOP("Patches and more"), "*****@*****.**");
  aboutData.addAuthor ("Dominik Haumann", I18N_NOOP("Developer & Highlight wizard"), "*****@*****.**");

  aboutData.addCredit ("Matteo Merli",I18N_NOOP("Highlighting for RPM Spec-Files, Perl, Diff and more"), "*****@*****.**");
  aboutData.addCredit ("Rocky Scaletta",I18N_NOOP("Highlighting for VHDL"), "*****@*****.**");
  aboutData.addCredit ("Yury Lebedev",I18N_NOOP("Highlighting for SQL"),"");
  aboutData.addCredit ("Chris Ross",I18N_NOOP("Highlighting for Ferite"),"");
  aboutData.addCredit ("Nick Roux",I18N_NOOP("Highlighting for ILERPG"),"");
  aboutData.addCredit ("Carsten Niehaus", I18N_NOOP("Highlighting for LaTeX"),"");
  aboutData.addCredit ("Per Wigren", I18N_NOOP("Highlighting for Makefiles, Python"),"");
  aboutData.addCredit ("Jan Fritz", I18N_NOOP("Highlighting for Python"),"");
  aboutData.addCredit ("Daniel Naber","","");
  aboutData.addCredit ("Roland Pabel",I18N_NOOP("Highlighting for Scheme"),"");
  aboutData.addCredit ("Cristi Dumitrescu",I18N_NOOP("PHP Keyword/Datatype list"),"");
  aboutData.addCredit ("Carsten Pfeiffer", I18N_NOOP("Very nice help"), "");
  aboutData.addCredit (I18N_NOOP("All people who have contributed and I have forgotten to mention"),"","");

  aboutData.setTranslator(I18N_NOOP2("NAME OF TRANSLATORS","Your names"), I18N_NOOP2("EMAIL OF TRANSLATORS","Your emails"));

  // command line args init and co
  KCmdLineArgs::init (argc, argv, &aboutData);
  KCmdLineArgs::addCmdLineOptions (options);
  KCmdLineArgs::addTempFileOption();
  KateApp::addCmdLineOptions ();

  // get our command line args ;)
  KCmdLineArgs* args = KCmdLineArgs::parsedArgs();

  // now, first try to contact running kate instance if needed
  if ( args->isSet("use") || (::getenv("KATE_PID")!=0) )
  {
    DCOPClient client;
    client.attach ();

    // get all attached clients ;)
    QCStringList allClients = client.registeredApplications();

    // search for a kate app client, use the first found
    QCString kateApp;

    if ( args->isSet("start") )
    {
      for (unsigned int i=0; i < allClients.count(); i++)
      {
        if (allClients[i] == "kate" || allClients[i].left(5) == "kate-")
        {
          DCOPRef ref( allClients[i], "KateApplication" );
          QString s = ref.call( "session" );
          if ( QString(args->getOption("start")) == s )
          {
            kateApp = allClients[i];
            break;
          }
        }
      }
    }
    else if ( (args->isSet("pid")) || (::getenv("KATE_PID") !=0 ) )
    {
      QCString tryApp;
      if ( args->isSet("pid") )
        tryApp = args->getOption("pid");
      else
        tryApp = ::getenv("KATE_PID");

      if ( client.isApplicationRegistered( tryApp.prepend("kate-") ) )
        kateApp = tryApp;
    }
    else
    {
      for (unsigned int i=0; i < allClients.count(); ++i)
      {
        if (allClients[i] == "kate" || allClients[i].left(5) == "kate-")
        {
          kateApp = allClients[i];
          break;
        }
      }
    }

    // found a matching kate client ;)
    if (!kateApp.isEmpty())
    {
      kdDebug () << "kate app: " << kateApp << endl;
      // make kdeinit happy
      client.registerAs( "kate" );

      DCOPRef kRef (kateApp, "KateApplication");

      if (args->isSet ("start"))
        kRef.call( "activateSession", QString (args->getOption("start")) );

      QString enc = args->isSet("encoding") ? args->getOption("encoding") : QCString("");

      bool tempfileSet = KCmdLineArgs::isTempFileSet();

      for (int z=0; z<args->count(); z++)
        kRef.call( "openURL", args->url(z), enc, tempfileSet );

      if( args->isSet( "stdin" ) )
      {
        QTextIStream input(stdin);

        // set chosen codec
        QTextCodec *codec = args->isSet("encoding") ? QTextCodec::codecForName(args->getOption("encoding")) : 0;

        if (codec)
          input.setCodec (codec);

        QString line;
        QString text;

        do
        {
          line = input.readLine();
          text.append( line + "\n" );
        } while( !line.isNull() );

        kRef.call( "openInput", text );
      }

      int line = 0;
      int column = 0;
      bool nav = false;

      if (args->isSet ("line"))
      {
        line = args->getOption ("line").toInt();
        nav = true;
      }

      if (args->isSet ("column"))
      {
        column = args->getOption ("column").toInt();
        nav = true;
      }

      if (nav)
         kRef.call( "setCursor", line, column );

      // since the user tried to open a document, let us assume [s]he
      // wants to see that document.
      // ### what to do about the infamous focus stealing prevention?
      uint mwn = kRef.call("activeMainWindowNumber");
      QCString smwn;
      DCOPRef wRef( kateApp, QCString( "__KateMainWindow#") + smwn.setNum(mwn) );
      if ( wRef.call("minimized") )
      {
        if ( wRef.call( "maximized" ) )
          wRef.call( "maximize" );
        else
          wRef.call("restore");
      }
      wRef.call( "raise" );

      // stop startup notification
      KStartupInfo::appStarted(  );

      return 0;
    }
  }

  // construct the real kate app object ;)
  KateApp app (args);

  // app execution should already end :)
  if (app.shouldExit())
  {
    return 0;
  }

  // execute ourself ;)
  return app.exec();
}
Пример #19
0
bool KSshProcess::setOptions(const SshOptList &opts)
{
    kdDebug(KSSHPROC) << "KSshProcess::setOptions()" << endl;
    mArgs.clear();
    SshOptListConstIterator it;
    QString cmd, subsystem;
    mPassword = mUsername = mHost = QString::null;
    QCString tmp;
    for(it = opts.begin(); it != opts.end(); ++it)
    {
        // kdDebug(KSSHPROC) << "opt.opt = " << (*it).opt << endl;
        // kdDebug(KSSHPROC) << "opt.str = " << (*it).str << endl;
        // kdDebug(KSSHPROC) << "opt.num = " << (*it).num << endl;
        switch((*it).opt)
        {
            case SSH_VERBOSE:
                mArgs.append("-v");
                break;

            case SSH_SUBSYSTEM:
                subsystem = (*it).str;
                break;

            case SSH_PORT:
                mArgs.append("-p");
                tmp.setNum((*it).num);
                mArgs.append(tmp);
                mPort = (*it).num;
                break;

            case SSH_HOST:
                mHost = (*it).str;
                break;

            case SSH_USERNAME:
                mArgs.append("-l");
                mArgs.append((*it).str.latin1());
                mUsername = (*it).str;
                break;

            case SSH_PASSWD:
                mPassword = (*it).str;
                break;

            case SSH_PROTOCOL:
                if(mVersion <= OPENSSH)
                {
                    tmp = "Protocol=";
                    tmp += QString::number((*it).num).latin1();
                    mArgs.append("-o");
                    mArgs.append(tmp);
                }
                else if(mVersion <= SSH)
                {
                    if((*it).num == 1)
                    {
                        mArgs.append("-1");
                    }
                    // else uses version 2 by default
                }
                break;

            case SSH_FORWARDX11:
                tmp = "ForwardX11=";
                tmp += (*it).boolean ? "yes" : "no";
                mArgs.append("-o");
                mArgs.append(tmp);
                break;

            case SSH_FORWARDAGENT:
                tmp = "ForwardAgent=";
                tmp += (*it).boolean ? "yes" : "no";
                mArgs.append("-o");
                mArgs.append(tmp);
                break;

            case SSH_ESCAPE_CHAR:
                if((*it).num == -1)
                    tmp = "none";
                else
                    tmp = (char)((*it).num);
                mArgs.append("-e");
                mArgs.append(tmp);
                break;

            case SSH_OPTION:
                // don't allow NumberOfPasswordPrompts or StrictHostKeyChecking
                // since KSshProcess depends on specific setting of these for
                // preforming authentication correctly.
                tmp = (*it).str.latin1();
                if(tmp.contains("NumberOfPasswordPrompts") || tmp.contains("StrictHostKeyChecking"))
                {
                    mError = ERR_INVALID_OPT;
                    return false;
                }
                else
                {
                    mArgs.append("-o");
                    mArgs.append(tmp);
                }
                break;

            case SSH_COMMAND:
                cmd = (*it).str;
                break;

            default:
                kdDebug(KSSHPROC) << "KSshProcess::setOptions(): "
                                     "unrecognized ssh opt "
                                  << (*it).opt << endl;
        }
    }

    if(!subsystem.isEmpty() && !cmd.isEmpty())
    {
        kdDebug(KSSHPROC) << "KSshProcess::setOptions(): "
                             "cannot use a subsystem and command at the same time"
                          << endl;
        mError = ERR_CMD_SUBSYS_CONFLICT;
        mErrorMsg = i18n("Cannot specify a subsystem and command at the same time.");
        return false;
    }

    // These options govern the behavior of ssh and
    // cannot be defined by the user
    // mArgs.append("-o");
    // mArgs.append("StrictHostKeyChecking=ask");
    mArgs.append("-v"); // So we get a message that the
                        // connection was successful
    if(mVersion <= OPENSSH)
    {
        // nothing
    }
    else if(mVersion <= SSH)
    {
        mArgs.append("-o"); // So we can check if the connection was successful
        mArgs.append("AuthenticationSuccessMsg=yes");
    }

    if(mHost.isEmpty())
    {
        kdDebug(KSSHPROC) << "KSshProcess::setOptions(): "
                             "a host name must be supplied"
                          << endl;
        return false;
    }
    else
    {
        mArgs.append(mHost.latin1());
    }

    if(!subsystem.isEmpty())
    {
        mArgs.append("-s");
        mArgs.append(subsystem.latin1());
    }

    if(!cmd.isEmpty())
    {
        mArgs.append(cmd.latin1());
    }

    return true;
}
Пример #20
0
QCString File::context() {
    QCString s;

    return QCString(name()) + " line " + s.setNum(line_number);
}
Пример #21
0
void UmlDiagram::html(QCString, unsigned int, unsigned int) {
  UmlCom::message(name());

  define();

  QCString s;
  
  s.setNum(getIdentifier());
  s = "fig" + s + ((svg) ? ".svg" : ".png");
  saveIn(directory + s);
  
  if (svg) {
    fw.write("<p align=\"center\"><embed src=\"");
    fw.write(s);
    fw.write('"');
    
    s = directory + s;
    
    FILE * fp = fopen((const char *) s, "r");
    
    if (fp != 0) {
      char line[256];
      
      (void) fgets(line, sizeof(line) - 1, fp);	// <?xml version="1.0" ...
      (void) fgets(line, sizeof(line) - 1, fp);	// <!-- Created with Bouml ...
      (void) fgets(line, sizeof(line) - 1, fp);	// <!DOCTYPE svg PUBLIC ...
      (void) fgets(line, sizeof(line) - 1, fp);	// <svg width="495" height="560" version=...
      fclose(fp);
      
      char * p = strstr(line, " version=");
      
      if (p != 0) {
	*p = 0;
	fw.write(line+4);
      }
    }
    
    fw.write("/></p>\n");
  }
  else {
    fw.write("<p align=\"center\"><img src=\"");
    fw.write(s);
    fw.write("\" alt=\"\" /></p>\n");
  }
  
  fw.write(" <p align=\"center\"><b>");
  writeq(name());
  fw.write("</b></p><p><br /></p><p><br /></p>\n");

  s = description();
  
  if (!s.isEmpty()) {
    fw.write("<p>");
    writeq(description());
    fw.write("<br /></p>");
  }

  write_properties();

  unload(FALSE, FALSE);
}