コード例 #1
0
ファイル: ksconfig.cpp プロジェクト: Fat-Zer/tdelibs
void
KSpellConfig::sSetDictionary (int i)
{
  setDictionary (langfnames[i]);
  setDictFromList (true);
  TQTimer::singleShot( 0, this, TQT_SIGNAL( configChanged() ) );
}
コード例 #2
0
ファイル: SpellCheck.cpp プロジェクト: Doug0212/Sigil
SpellCheck::SpellCheck() :
    m_hunspell(0),
    m_codec(0),
    m_wordchars("")
{
    // There is a considerable lag involved in loading the Spellcheck dictionaries
    QApplication::setOverrideCursor(Qt::WaitCursor);
    loadDictionaryNames();
    // Create the user dictionary word list directiory if necessary.
    const QString user_directory = userDictionaryDirectory();
    QDir userDir(user_directory);

    if (!userDir.exists()) {
        userDir.mkpath(user_directory);
    }

    // Create the configured file if necessary.
    QFile userFile(currentUserDictionaryFile());

    if (!userFile.exists()) {
        if (userFile.open(QIODevice::WriteOnly)) {
            userFile.close();
        }
    }

    // Load the dictionary the user has selected if one was saved.
    SettingsStore settings;
    setDictionary(settings.dictionary());
    QApplication::restoreOverrideCursor();
}
コード例 #3
0
QtWebKitSpellChecker::QtWebKitSpellChecker() : QWebSpellChecker(),
    m_speller(NULL)
{
    setDictionary(QtWebKitWebBackend::getActiveDictionary());

    connect(QtWebKitWebBackend::getInstance(), SIGNAL(activeDictionaryChanged(QString)), this, SLOT(setDictionary(QString)));
}
コード例 #4
0
ファイル: ksconfig.cpp プロジェクト: Fat-Zer/tdelibs
bool
KSpellConfig::readGlobalSettings()
{
  TDEConfigGroupSaver cs( kc,"KSpell" );

  setNoRootAffix   ( kc->readNumEntry("KSpell_NoRootAffix", 0) );
  setRunTogether   ( kc->readNumEntry("KSpell_RunTogether", 0) );
  setDictionary    ( kc->readEntry("KSpell_Dictionary") );
  setDictFromList  ( kc->readNumEntry("KSpell_DictFromList", false) );
  setEncoding ( kc->readNumEntry ("KSpell_Encoding", KS_E_UTF8) );
  setClient ( kc->readNumEntry ("KSpell_Client", KS_CLIENT_ISPELL) );

  return true;
}
コード例 #5
0
ファイル: ksconfig.cpp プロジェクト: Fat-Zer/tdelibs
void
KSpellConfig::operator= (const KSpellConfig &ksc)
{
  //We want to copy the data members, but not the
  //pointers to the child widgets
  setNoRootAffix (ksc.noRootAffix());
  setRunTogether (ksc.runTogether());
  setDictionary (ksc.dictionary());
  setDictFromList (ksc.dictFromList());
  //  setPersonalDict (ksc.personalDict());
  setEncoding (ksc.encoding());
  setClient (ksc.client());

  fillInDialog();
}
コード例 #6
0
ファイル: ksconfig.cpp プロジェクト: Fat-Zer/tdelibs
void
KSpellConfig::sDictionary(bool on)
{
  if (on)
  {
    dictcombo->setEnabled (true);
    setDictionary (langfnames[dictcombo->currentItem()] );
    setDictFromList (true);
  }
  else
  {
    dictcombo->setEnabled (false);
  }
  emit configChanged();
}
コード例 #7
0
ファイル: morfologik.cpp プロジェクト: jgonz0010/psi-toolkit
Morfologik::Morfologik(const boost::program_options::variables_map& options)
    : level_(3), dictionary_("MORFOLOGIK"), annotationManager_(NULL), foundLemma_(false) {

    if (options.count("level") > 0) setLevel(options["level"].as<int>());
    if (options.count("dict") > 0) setDictionary(options["dict"].as<std::string>());
    keepOriginal_ = options.count("keep-original") ? true : false;

    jenv_ = NULL;
    JavaVirtualMachine *jvm = JavaVirtualMachine::Instance();
    jenv_ = jvm->getENV();

    initializeDictionary_();
    initializePolishStemmer_();
    initializeList_();
    initializeWordData_();
    initializeString_();
}
コード例 #8
0
/**
 * @brief Removes all the entries from the dictionary related to the given user
 *
 * pythonInit() must have been called before or an error will occur (the module is not loaded)
 * @param user Name of the user whose entries will be removed
 * @return 1 on success, or 0 otherwise
 */
int dictionaryRemoveUserEntries(const char* user){
    PyObject *dictionary;

    if((dictionary = getDictionary()) == Py_None){
        return 0;
    }

    if(PyDict_Contains(PyDict_GetItemString(dictionary, "incoming"), PyUnicode_FromString(user))){
        PyDict_DelItemString(PyDict_GetItemString(dictionary, "incoming"), user);
    }

    if(PyDict_Contains(PyDict_GetItemString(dictionary, "outgoing"), PyUnicode_FromString(user))){
        PyDict_DelItemString(PyDict_GetItemString(dictionary, "outgoing"), user);
    }

    setDictionary(dictionary);
    Py_XDECREF(dictionary);

    return 1;
}
コード例 #9
0
ファイル: ksconfig.cpp プロジェクト: Fat-Zer/tdelibs
KSpellConfig::KSpellConfig (const KSpellConfig &_ksc)
  : TQWidget(0, 0), nodialog(true)
  , kc(0)
  , cb1(0)
  , cb2(0)
  , dictlist(0)
  , dictcombo(0)
  , encodingcombo(0)
  , clientcombo(0)
{
  d = new KSpellConfigPrivate;
  setReplaceAllList( _ksc.replaceAllList() );
  setNoRootAffix( _ksc.noRootAffix() );
  setRunTogether( _ksc.runTogether() );
  setDictionary( _ksc.dictionary() );
  setDictFromList( _ksc.dictFromList() );
  //  setPersonalDict (_ksc.personalDict());
  setIgnoreList( _ksc.ignoreList() );
  setEncoding( _ksc.encoding() );
  setClient( _ksc.client() );
}
コード例 #10
0
ファイル: hashcat.cpp プロジェクト: bitland/disthc
int Ngn_Hashcat::run ()
{
	Application& app = Application::instance();
	DJob *job = DJob::Instance();
	string cmd;
	string hashcat(dengine->getBinaryPath("hashcat"));
	int eCode(-1);
	
	// clean results
	_results = string("");
	
	// grab settings from job
	setAttackMode(job->getAttackMode());
	setHashType(job->getHashType());
	setMask(job->getMask());
	setRules(job->getRules());
	setDictionary(job->getDictionary());
	setPot("disthc.pot");
	
	// clean pot before working
	File f(getPot());
	if(f.exists()) {
		f.remove();
	}
	
	// setup command prefix (format command takes 7 args max)
	cmd = format("%s -o %s -s %lu -l %u",
		hashcat,
		getPot(),
		job->getChunk(),
		job->getChunkSize()
	);
	
	// Attack modes:
	// 0 = Straight
	// 1 = Combination
	// 2 = Toggle-Case
	// 3 = Brute-force
	// 4 = Permutation
	// 5 = Table-Lookup
	
	// if mask minimum set, apply it
	if(job->getMaskMin())
	{
		cmd = format("%s --pw-min %d",
			cmd,
			job->getMaskMin()
		);
	}
	
	// if mask maximum set, apply it
	if(job->getMaskMax())
	{
		cmd = format("%s --pw-min %d",
			cmd,
			job->getMaskMax()
		);
	}
	
	// discover attack mode and create command to execute
	switch(getAttackMode())
	{
		case 3:
			cmd = format("%s -a3 -m %d %s %s %s",
				cmd,
				getHashType(),
				getFlags(),
				getHashFile(),
				getMask()
			);
			break;
		default:
			// default command uses attack mode 0
			cmd = format("%s -m %d %s %s %s %s",
				cmd,
				getHashType(),
				getFlags(),
				getHashFile(),
				getDictionary(),
				getRules()
			);
	}
	
	if(DEBUG) app.logger().information(format("%%Running command: %s", cmd));

	// check for ghosts, and run as appropriate
	if(isGhost())
	{
		app.logger().information("~~~ A ghost is loose! ~~~");
		app.logger().information("      .-.");
		app.logger().information("     (o o) boo!");
		app.logger().information("    \\| O \\/");
		app.logger().information("      \\   \\ ");
		app.logger().information("       `~~~' ");
	}
	else
	{
		// run hashcat!  :)
		// TODO change this over to use Poco Processes
		eCode = system(cmd.c_str());
		
		// check for results
		if(f.exists()) {
			FileInputStream fis(getPot());
			//std::ifstream in(pot,std::ios::in);
			string line;
			while(fis >> line) {
				_results.append(line + "\n");
			}
		}
		
		// TODO might take this out?
		// see if it's worth it to just display hashcout output during
		// execution
		// if enabled, print pot to screen
//		if(false) {
//			app.logger().information("\n=== Recovered Hashes ===");
//			if(!_results.empty()) app.logger().information(_results);
//			app.logger().information("========================");
//		}
	}
コード例 #11
0
ファイル: ksconfig.cpp プロジェクト: Fat-Zer/tdelibs
KSpellConfig::KSpellConfig( TQWidget *parent, const char *name,
			    KSpellConfig *_ksc, bool addHelpButton )
  : TQWidget (parent, name), nodialog(false)
  , kc(0)
  , cb1(0)
  , cb2(0)
  , dictlist(0)
  , dictcombo(0)
  , encodingcombo(0)
  , clientcombo(0)
{
  d = new KSpellConfigPrivate;
  kc = TDEGlobal::config();

  if( !_ksc )
  {
    readGlobalSettings();
  }
  else
  {
    setNoRootAffix( _ksc->noRootAffix() );
    setRunTogether( _ksc->runTogether() );
    setDictionary( _ksc->dictionary() );
    setDictFromList( _ksc->dictFromList() );
    //setPersonalDict (_ksc->personalDict());
    setIgnoreList( _ksc->ignoreList() );
    setEncoding( _ksc->encoding() );
    setClient( _ksc->client() );
  }

  TQGridLayout *glay = new TQGridLayout( this, 6, 3, 0, KDialog::spacingHint() );
  cb1 = new TQCheckBox( i18n("Create &root/affix combinations"
                            " not in dictionary"), this, "NoRootAffix" );
  connect( cb1, TQT_SIGNAL(toggled(bool)), TQT_SLOT(sNoAff(bool)) );
  glay->addMultiCellWidget( cb1, 0, 0, 0, 2 );

  cb2 = new TQCheckBox( i18n("Consider run-together &words"
			    " as spelling errors"), this, "RunTogether" );
  connect( cb2, TQT_SIGNAL(toggled(bool)), TQT_SLOT(sRunTogether(bool)) );
  glay->addMultiCellWidget( cb2, 1, 1, 0, 2 );

  dictcombo = new TQComboBox( this, "DictFromList" );
  dictcombo->setInsertionPolicy( TQComboBox::NoInsertion );
  connect( dictcombo, TQT_SIGNAL (activated(int)),
	   this, TQT_SLOT (sSetDictionary(int)) );
  glay->addMultiCellWidget( dictcombo, 2, 2, 1, 2 );

  dictlist = new TQLabel( dictcombo, i18n("&Dictionary:"), this );
  glay->addWidget( dictlist, 2 ,0 );

  encodingcombo = new TQComboBox( this, "Encoding" );
  encodingcombo->insertItem( "US-ASCII" );
  encodingcombo->insertItem( "ISO 8859-1" );
  encodingcombo->insertItem( "ISO 8859-2" );
  encodingcombo->insertItem( "ISO 8859-3" );
  encodingcombo->insertItem( "ISO 8859-4" );
  encodingcombo->insertItem( "ISO 8859-5" );
  encodingcombo->insertItem( "ISO 8859-7" );
  encodingcombo->insertItem( "ISO 8859-8" );
  encodingcombo->insertItem( "ISO 8859-9" );
  encodingcombo->insertItem( "ISO 8859-13" );
  encodingcombo->insertItem( "ISO 8859-15" );
  encodingcombo->insertItem( "UTF-8" );
  encodingcombo->insertItem( "KOI8-R" );
  encodingcombo->insertItem( "KOI8-U" );
  encodingcombo->insertItem( "CP1251" );
  encodingcombo->insertItem( "CP1255" );

  connect( encodingcombo, TQT_SIGNAL(activated(int)), this,
	   TQT_SLOT(sChangeEncoding(int)) );
  glay->addMultiCellWidget( encodingcombo, 3, 3, 1, 2 );

  TQLabel *tmpQLabel = new TQLabel( encodingcombo, i18n("&Encoding:"), this);
  glay->addWidget( tmpQLabel, 3, 0 );


  clientcombo = new TQComboBox( this, "Client" );
  clientcombo->insertItem( i18n("International Ispell") );
  clientcombo->insertItem( i18n("Aspell") );
  clientcombo->insertItem( i18n("Hspell") );
  clientcombo->insertItem( i18n("Zemberek") );
  connect( clientcombo, TQT_SIGNAL (activated(int)), this,
	   TQT_SLOT (sChangeClient(int)) );
  glay->addMultiCellWidget( clientcombo, 4, 4, 1, 2 );

  tmpQLabel = new TQLabel( clientcombo, i18n("&Client:"), this );
  glay->addWidget( tmpQLabel, 4, 0 );

  if( addHelpButton )
  {
    TQPushButton *pushButton = new KPushButton( KStdGuiItem::help(), this );
    connect( pushButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(sHelp()) );
    glay->addWidget(pushButton, 5, 2);
  }

  fillInDialog();
}