Example #1
0
void CDPWizard::promptForFileName(QLineEdit * theLineEdit, QString theShortName, QString theLongName)
{
    QSettings myQSettings;
    QString myFilterList;
    FileReader::getGdalDriverMap(myFilterList);
    QString myWorkDirString = myQSettings.readEntry("/qgis/cdpwizard/DefaultDirectories/" + theShortName + "Dir",QDir::homeDirPath());

    std::cout << "Filter List: " << myFilterList << std::endl;
    QString myFileNameQString;
    QFileDialog myFileDialog (myWorkDirString,myFilterList,0,"Select " + theLongName ,"Select " + theLongName);
    QString myLastFilter = myQSettings.readEntry("/qgis/cdpwizard/DefaultDirectories/" + theShortName + "Filter","");
    if (!myLastFilter.isEmpty())
    {
      myFileDialog.setSelectedFilter(myLastFilter);
    }
    if ( myFileDialog.exec() == QDialog::Accepted )
    {
      myFileNameQString = myFileDialog.selectedFile();
      theLineEdit->setText(myFileNameQString);
      QFileInfo myFileInfo(myFileNameQString);
      myQSettings.writeEntry("/qgis/cdpwizard/DefaultDirectories/" + theShortName + "Dir",myFileInfo.dirPath());
      myQSettings.writeEntry("/qgis/cdpwizard/DefaultDirectories/" + theShortName + "Filter",myFileDialog.selectedFilter());
      checkInputFilenames();
    }
}
/*!
  Unregisters the component with id \a cid from the system component registry and returns
  TRUE if the component was unregistered successfully, otherwise returns FALSE.

  Call this function for each component in an implementation of
  \link QComponentRegistrationInterface::unregisterComponents() unregisterComponents() \endlink.

  \sa registerComponent(), unregisterServer()
*/
bool QComponentFactory::unregisterComponent( const QUuid &cid )
{
    QSettings settings;
    bool ok = FALSE;
    settings.insertSearchPath( QSettings::Windows, "/Classes" );

    QString cidStr = cid.toString().upper();
    if ( cidStr.isEmpty() )
	return FALSE;

    // unregister the human readable part
    QString vName = settings.readEntry( "/CLSID/" + cidStr + "/ProgID/Default", QString::null, &ok );
    if ( ok ) {
	QString name = settings.readEntry( "/CLSID/" + cidStr + "/VersionIndependentProgID/Default", QString::null );
	if ( !!name && settings.readEntry( "/" + name + "/CurVer/Default" ) == vName ) {
	    // unregistering the current version -> change CurVer to previous version
	    QString version = vName.right( vName.length() - name.length() - 1 );
	    QString newVerName;
	    QString newCidStr;
	    if ( version.find( '.' ) == -1 ) {
		int ver = version.toInt();
		// see if a lesser version is installed, and make that the CurVer
		while ( ver-- ) {
		    newVerName = name + "." + QString::number( ver );
		    newCidStr = settings.readEntry( "/" + newVerName + "/CLSID/Default" );
		    if ( !!newCidStr )
			break;
		}
	    } else {
		// oh well...
	    }
	    if ( !!newCidStr ) {
		settings.writeEntry( "/" + name + "/CurVer/Default", newVerName );
		settings.writeEntry( "/" + name + "/CLSID/Default", newCidStr );
	    } else {
		settings.removeEntry( "/" + name + "/CurVer/Default" );
		settings.removeEntry( "/" + name + "/CLSID/Default" );
		settings.removeEntry( "/" + name + "/Default" );
	    }
	}

	settings.removeEntry( "/" + vName + "/CLSID/Default" );
	settings.removeEntry( "/" + vName + "/Default" );
    }

    settings.removeEntry( "/CLSID/" + cidStr + "/VersionIndependentProgID/Default" );
    settings.removeEntry( "/CLSID/" + cidStr + "/ProgID/Default" );
    settings.removeEntry( "/CLSID/" + cidStr + "/InprocServer32/Default" );
    ok = settings.removeEntry( "/CLSID/" + cidStr + "/Default" );

    return ok;
}
Example #3
0
void NYBOT::loadSettings ()
{
  QSettings settings;
  settings.beginGroup("/Qtstalker/NYBOT plugin");
  
  QString s = settings.readEntry("/Retry", "3");
  retrySpin->setValue(s.toInt());
  
  s = settings.readEntry("/Timeout", "15");
  timeoutSpin->setValue(s.toInt());
  
  settings.endGroup();
}
void QCPPDialogImpl::readSettings()
{
   QSettings settings;
   m_hardwareCb->setChecked(settings.readBoolEntry("/cutecom/HardwareHandshake", false));
   m_softwareCb->setChecked(settings.readBoolEntry("/cutecom/SoftwareHandshake", false));
   m_readCb->setChecked(settings.readBoolEntry("/cutecom/OpenForReading", true));
   m_writeCb->setChecked(settings.readBoolEntry("/cutecom/OpenForWriting", true));

   m_applyCb->setChecked(!settings.readBoolEntry("/cutecom/DontApplySettings", false));
   enableSettingWidgets(m_applyCb->isChecked());

   m_baudCb->setCurrentItem(settings.readNumEntry("/cutecom/Baud", 7));
   m_dataBitsCb->setCurrentItem(settings.readNumEntry("/cutecom/Databits", 3));
   m_parityCb->setCurrentItem(settings.readNumEntry("/cutecom/Parity", 0));
   m_stopCb->setCurrentItem(settings.readNumEntry("/cutecom/Stopbits", 0));
   m_protoPb->setCurrentItem(settings.readNumEntry("/cutecom/Protocol", 0));

   m_inputModeCb->setCurrentItem(settings.readNumEntry("/cutecom/LineMode", 0));
   m_hexOutputCb->setChecked(settings.readBoolEntry("/cutecom/HexOutput", false));
   m_charDelaySb->setValue(settings.readNumEntry("/cutecom/CharDelay", 1));

   m_sendFileDialogStartDir=settings.readEntry("/cutecom/SendFileDialogStartDir", QDir::homeDirPath());
   m_logFileLe->setText(settings.readEntry("/cutecom/LogFileName", QDir::homeDirPath()+"/cutecom.log"));

   m_logAppendCb->setCurrentItem(settings.readNumEntry("/cutecom/AppendToLogFile", 0));

   int x=settings.readNumEntry("/cutecom/width", -1);
   int y=settings.readNumEntry("/cutecom/height", -1);
   if ((x>100) && (y>100))
      resize(x,y);

   bool entryFound=false;
   QStringList devices=settings.readListEntry("/cutecom/AllDevices", &entryFound);
   if (!entryFound)
      devices<<"/dev/ttyS0"<<"/dev/ttyS1"<<"/dev/ttyS2"<<"/dev/ttyS3";

   m_deviceCb->insertStringList(devices);

   m_deviceCb->setCurrentText(settings.readEntry("/cutecom/CurrentDevice", "/dev/ttyS0"));

   QStringList history=settings.readListEntry("/cutecom/History");

   if (!history.empty())
   {
      m_oldCmdsLb->insertStringList(history);
      m_oldCmdsLb->setCurrentItem(m_oldCmdsLb->count()-1);
      m_oldCmdsLb->ensureCurrentVisible();
      m_oldCmdsLb->clearSelection();
   }
}
Example #5
0
int main(int argc, char** argv) {
#ifdef XQ_WS_WIN
    WSADATA wsaData;
    if(WSAStartup(MAKEWORD(1, 1), &wsaData)) {
        qDebug("Failed to initialize Window Sockets library.");
    }
#endif

    QApplication app(argc, argv);

    QSplashScreen * splash = new QSplashScreen(QPixmap(":/images/openrpt.png"));
    splash->show();

    _databaseURL = "";
    QStringList xml_files;

    if (argc > 1)
    {
      for (int intCounter = 1; intCounter < argc; intCounter++)
      {
        QString argument(argv[intCounter]);

        if (argument.startsWith("-databaseURL=", false))
          _databaseURL = argument.right(argument.length() - 13);
        else if(argument.startsWith("-f=", false))
          xml_files.append(argument.right(argument.length() - 3));
        else if(!argument.startsWith("-"))
          xml_files.append(argument);
      }
    }

    if (_databaseURL == "")
    {
        QSettings settings;
        settings.setPath("OpenMFG.com", "OpenRPT", QSettings::UserScope);
        _databaseURL = settings.readEntry("/OpenRPT/_databaseURL", "pgsql://127.0.0.1/mfg:5432");
    }

    app.addLibraryPath(".");

    ReportWriterWindow * rwf = new ReportWriterWindow();

    for(int i = 0; i < xml_files.size(); i++)
      rwf->openReportFile(xml_files.at(i));

    app.setMainWidget( rwf );
    rwf->show();

    app.connect( &app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()) );
    qApp->processEvents();
    splash->finish(rwf);
    delete splash;
    int ret = app.exec();

#ifdef XQ_WS_WIN
    WSACleanup();
#endif

    return ret;
}
Example #6
0
void DominoConfig::loadButtonContourColors() {
	
	QColor background = vBox->paletteBackgroundColor();
	if(useDominoStyleContourColors->isChecked()) {
		QSettings s;
		buttonContourColor->setColor(s.readEntry("/domino/Settings/buttonContourColor", background.dark(250).name()));
		buttonMouseOverContourColor->setColor(s.readEntry("/domino/Settings/buttonMouseOverContourColor", background.dark(250).name()));
		buttonPressedContourColor->setColor(s.readEntry("/domino/Settings/buttonPressedContourColor", background.dark(250).name()));
	}
	else {
		buttonContourColor->setColor(conf->readEntry("buttonContourColor", background.dark(250).name()));
		buttonMouseOverContourColor->setColor(conf->readEntry("buttonMouseOverContourColor", background.dark(250).name()));
		buttonPressedContourColor->setColor(conf->readEntry("buttonPressedContourColor", background.dark(250).name()));
	}
	
}
Example #7
0
void KReferDialog::getUri( void )
{
	QSettings settings;
	QString p = KStatics::dBase + userPrefix + "/local";
	QString xmlFile = settings.readEntry( p + "/PhoneBook", "" );
	if( xmlFile.isEmpty() ) {
		if( userPrefix.isEmpty() ) {
			xmlFile = QDir::homeDirPath() + "/." + KStatics::xBase + "-phonebook.xml";
		} else {
			xmlFile = QDir::homeDirPath() + "/." + KStatics::xBase + "_" + userPrefix + "phonebook.xml";
		}
	}		

	
	QStringList r;
	if( !phoneBook ) {
		phoneBook = new PhoneBook( xmlFile, this,
			userPrefix + tr("Phone Book"),
			receivedCalls, missedCalls, dialledCalls );
	}
	

	phoneBook->exec();
	
	touri->setText( phoneBook->getUri() );
	//((KPhoneView *)parentWidget())->updateContacts( xmlFile );
}
Example #8
0
void Text::loadDefaults ()
{
  QSettings settings;
  
  QString s = "/Qtstalker/DefaultTextColor";
  s = settings.readEntry(s);
  if (s.length())
    defaultColor.setNamedColor(s);

  s = "/Qtstalker/DefaultTextFont";
  s = settings.readEntry(s);
  if (s.length())
  {
    QStringList l = QStringList::split(",", s, FALSE);
    font = QFont(l[0], l[1].toInt(), l[2].toInt());
  }
}
Example #9
0
void SellArrow::loadDefaults ()
{
  QSettings settings;
  
  QString s = "/Qtstalker/DefaultSellArrowColor";
  s = settings.readEntry(s);
  if (s.length())
    defaultColor.setNamedColor(s);
}
Example #10
0
void VerticalLine::loadDefaults ()
{
  QSettings settings;

  QString s = "/Qtstalker/DefaultVerticalLineColor";
  s = settings.readEntry(s);
  if (s.length())
    defaultColor.setNamedColor(s);
}
Example #11
0
/*!
 *\~english
 *	Reads variable from config file.
 *\~russian
 *	Читает переменную из конфига. 
 *\~
 *	\param name - \~english variable name to read \~russian Имя переменной для чтения \~ 
 *	\param ok (out) -	\~english true if success, false otherwise 
 				\~russian true если успешно иначе false \~ 
 *	\return - \~english Variable value \~russian Значение переменной \~ 
 *	\see writeConfigVariable(const QString &name, const QString &value)
 *	\see loadSizeFromConfig(const QString &mdname)
 *	\see saveSize2Config(QRect windowSize, const QString &mdname)
*/
QString
aService::readConfigVariable(const QString &name, bool *ok)
{
	QSettings settings;
	settings.insertSearchPath( QSettings::Unix, QString(QDir::homeDirPath())+QString("/.ananas"));
	settings.insertSearchPath( QSettings::Windows, "/ananasgroup/ananas" );
	settings.beginGroup(QString("/config/variables"));
	return settings.readEntry(QString("/%1").arg(name), "", ok);
}
Example #12
0
void SRTPWrapper::protect(unsigned char* rtp_h, int* length){
#ifdef SRTP	
	rtp_hdr_t* hdr = (rtp_hdr_t *) rtp_h;
	QSettings settings;
	if(!sessionActive){
		if(settings.readEntry(KStatics::dBase + "SRTP/Mode", "") == "PSK"){
			localSSRC = rand();
			ssrc_t ssrc;
			ssrc.value = localSSRC;
			ssrc.type = ssrc_any_outbound;
			if (err_status_t err = this->newSession(ssrc)){
			libError(err);
				cout << "SRTP session creation failed (protect)." << endl;
			}else{
				cout << "SRTP session created! (PSK)" << endl;
				sessionActive = true;
			}
		} else if(settings.readEntry(KStatics::dBase + "SRTP/Mode", "") == "PKE"){
				if(err_status_t err = this->newSession()){
					libError(err);
					cout << "SRTP session creation failed (protect) (PKE)." << endl;
				}else{
					cout << "SRTP session created!" << endl;
					sessionActive = true;
				}
		} else {
				cout << "Key exchange Mode not supported: " << 	settings.readEntry(KStatics::dBase + "SRTP/Mode", "") << endl;
				return;
		}
	}
	
	
	if(!outboundStreamActive){
		session->stream_template->direction = dir_srtp_sender;
		outboundStreamActive = true;
	}
	hdr->ssrc = localSSRC; //KPhone uses the same SSRC for all Streams, this produces replay errors in SRTP
	
	if(err_status_t err = srtp_protect(session, rtp_h, length)){
		cout << "srtp_protect: ";
		libError(err);
	}
#endif
}
/*!
  Searches for the component identifier \a cid in the system component registry,
  loads the corresponding component server and queries for the interface \a iid.
  \a iface is set to the resulting interface pointer. \a cid can either be the
  UUID or the name of the component.

  The parameter \a outer is a pointer to the outer interface used
  for containment and aggregation and is propagated to the \link
  QComponentFactoryInterface::createInstance() createInstance() \endlink
  implementation of the QComponentFactoryInterface in the component server if
  provided.

  The function returns QS_OK if the interface was successfully instantiated, QE_NOINTERFACE if
  the component does not provide an interface \a iid, or QE_NOCOMPONENT if there was
  an error loading the component.

  Example:
  \code
  QInterfacePtr<MyInterface> iface;
  if ( QComponentFactory::createInstance( IID_MyInterface, CID_MyComponent, (QUnknownInterface**)&iface ) == QS_OK )
      iface->doSomething();
      ...
  }
  \endcode
*/
QRESULT QComponentFactory::createInstance( const QString &cid, const QUuid &iid, QUnknownInterface** iface, QUnknownInterface *outer )
{
    QSettings settings;
    settings.insertSearchPath( QSettings::Windows, "/Classes" );
    bool ok = FALSE;
    QString cidStr = cid;
    QRESULT res = QE_NOCOMPONENT;

    QUuid uuid( cidStr ); // try to parse, and resolve CLSID if necessary
    if ( uuid.isNull() ) {
	uuid = settings.readEntry( "/" + cid + "/CLSID/Default", QString::null, &ok );
	cidStr = uuid.toString().upper();
    }

    if ( cidStr.isEmpty() )
	return res;

    QString file = settings.readEntry( "/CLSID/" + cidStr + "/InprocServer32/Default", QString::null, &ok );
    if ( !ok )
	return res;

    QComLibrary *library = new QComLibrary( file );
    library->setAutoUnload( FALSE );

    QComponentFactoryInterface *cfIface =0;
    library->queryInterface( IID_QComponentFactory, (QUnknownInterface**)&cfIface );

    if ( cfIface ) {
	res = cfIface->createInstance( uuid, iid, iface, outer );
	cfIface->release();
    } else {
	res = library->queryInterface( iid, iface );
    }
    QLibraryInterface *libiface = 0;
    if ( library->queryInterface( IID_QLibrary, (QUnknownInterface**)&libiface ) != QS_OK || !qApp ) {
	delete library; // only deletes the object, thanks to QLibrary::Manual
    } else {
	libiface->release();
	library->setAutoUnload( TRUE );
	liblist()->prepend( library );
    }
    return res;
}
Example #14
0
void UnicodeViewWidget::readConfig()
{
    QSettings settings;
    QString str;

    // splitter
    str = settings.readEntry( "/uim-kdehelper/chardict/unicodeview/splitter" );
    if ( !str.isEmpty() )
    {
        QTextIStream in( &str );
        in >> *m_mainSplitter;
    }
Example #15
0
void RcFile::loadData (Parm name, QString &value, const QString &s)
{
  QString k;
  k.append("/Qtstalker/");
  k.append(Key[name]);
  k.append(s);
  
  value = Def[name];
  
  QSettings settings;
  value = settings.readEntry(k, value);
}
Example #16
0
int login::set(ParameterList &pParams, QSplashScreen *pSplash)
{
  _splash = pSplash;
  
  QVariant param;
  bool     valid;

  param = pParams.value("username", &valid);
  if (valid)
  {
    _username->setText(param.toString());
    _password->setFocus();
    _captive = TRUE;
  }
  else
  {
    _username->setFocus();
    _captive = FALSE;
  }

  param = pParams.value("copyright", &valid);
  if (valid)
    _copyrightLit->setText(param.toString());

  param = pParams.value("version", &valid);
  if (valid)
    _versionLit->setText(tr("Version ") + param.toString());

  param = pParams.value("build", &valid);
  if (valid)
    _build->setText(param.toString());

  param = pParams.value("name", &valid);
  if (valid)
  {
    _nameLit->setText(param.toString());
  }

  param = pParams.value("databaseURL", &valid);
  if (valid)
    _databaseURL = param.toString();
  else
  {
    QSettings settings;
    settings.setPath("OpenMFG.com", "OpenRPT", QSettings::UserScope);
    _databaseURL = settings.readEntry("/OpenRPT/_databaseURL", "pgsql://127.0.0.1/mfg:5432");
  }

  populateDatabaseInfo();

  return 0;
}
Example #17
0
octet_t* SRTPWrapper::readKey(){
	QSettings settings;
	QString qkey = settings.readEntry(KStatics::dBase + "SRTP/KeyValue", "");
	string test = qkey;
	if(test.length() < 30){
		int i = 30 - test.length();
		test.append(i, '0');
		cout << "WARNING: The chosen key is to short (<30) and will be padded!" << endl;
	}
	string* strKey = new string(test);
	unsigned char* tmp = (unsigned char*) strKey->c_str();
	return tmp;
}
Example #18
0
void preferencesForm::loadSettings()
{
    QSettings settings;
    settings.setPath( "Tabuleiro.com", "Arca Database Browser 2", QSettings::UserScope );

   defaultencoding = settings.readEntry( "/db/defaultencoding", "UTF8" );
   defaultnewdata = settings.readEntry( "/db/defaultnewdata", "NULL" );
   defaultlocation = settings.readEntry( "/db/defaultlocation", QDir::homeDirPath () );
   defaulttext = settings.readEntry( "/db/defaulttext", "Plain" );
   
   if (defaultencoding=="Latin1")
   {
   encodingComboBox->setCurrentItem(1) ;
    } else {
    encodingComboBox->setCurrentItem(0) ;
    defaultencoding = QString("UTF8");
   }
    
    if (defaultnewdata=="\'\'")
   {
   defaultdataComboBox->setCurrentItem(2) ;
    } else if (defaultnewdata=="0")
   {
   defaultdataComboBox->setCurrentItem(1) ;
    } else {
    defaultdataComboBox->setCurrentItem(0) ;
    defaultnewdata = QString("NULL");
   }

    if (defaulttext=="Auto")
   {
   defaultTextComboBox->setCurrentItem(1) ;
    } else {
    defaultTextComboBox->setCurrentItem(0) ;
    defaulttext = QString("Plain");
   }
    
    locationEdit->setText(defaultlocation);
}
Example #19
0
void CSV::loadSettings ()
{
  QSettings settings;
  settings.beginGroup("/Qtstalker/CSV plugin");

  QString s = settings.readEntry("/RuleName");
  ruleCombo->setCurrentText(s);

  s = settings.readEntry("/DateRange", "0");
  dateRange->setChecked(s.toInt());
  dateRangeChanged(s.toInt());

  lastPath = settings.readEntry("/lastPath", QDir::homeDirPath());
  QStringList l;
  l.append(lastPath);
  file->setFile(l);

  s = settings.readEntry("/ReloadInterval", "0");
  minutes->setValue(s.toInt());

  settings.endGroup();
}
Example #20
0
RosterBox::RosterBox( QWidget* parent, const char* name )
	: QListView( parent, name ), QToolTip( viewport() )
{
	QSettings settings;
	settings.setPath( "qtlen.sf.net", "QTlen" );
	
	settings.beginGroup( "/look" );
	
	header()->hide();
	
	setResizeMode( QListView::AllColumns );
	addColumn( QString::null );
	setTreeStepSize( 5 );
	
	setPaletteBackgroundColor( (QColor)settings.readEntry( "/roster/background", "#eeeeee" ) );
	setPaletteForegroundColor( (QColor)settings.readEntry( "/roster/foreground", "#000000" ) );
	
	setSorting( -1 );
	
	connect( roster_manager, SIGNAL( refreshContext() ),
			this, SLOT( refreshContext() ) );
	
	connect( this, SIGNAL( clicked( QListViewItem * ) ),
			SLOT( clicked( QListViewItem * ) ) );
	connect( this, SIGNAL( doubleClicked( QListViewItem *, const QPoint &, int ) ),
			SLOT( doubleClicked( QListViewItem *, const QPoint &, int ) ) );
	connect( this, SIGNAL( contextMenuRequested( QListViewItem *, const QPoint &, int ) ),
			SLOT( contextMenuRequested( QListViewItem *, const QPoint &, int ) ) );
	
	connect( this, SIGNAL( itemRenamed(QListViewItem *, int, const QString &) ),
			SLOT( itemRenamed(QListViewItem *, int, const QString &) ) );
	
	menu = new QPopupMenu( this );
	menu->insertItem( QIconSet( takePixmap( "msg" ) ), tr( "New &message" ),  this, SLOT( newMessage() ), CTRL+Key_M );
	menu->insertItem( QIconSet( takePixmap( "msg-chat" ) ), tr( "New &chat" ),  this, SLOT( newChatMessage() ), CTRL+Key_C );
	menu->insertSeparator();
	menu->insertItem( QIconSet( takePixmap( "edit" ) ), tr( "Edit contact" ),  this, SLOT( edit() ) );
	menu->insertItem( QIconSet( takePixmap( "find" ) ), tr( "Check in pubdir" ),  this, SLOT( pubdir() ) );
	menu->insertSeparator();
	menu->insertItem( QIconSet( takePixmap( "rename" ) ), tr( "Rename contect" ),  this, SLOT( rename() ) );
	menu->insertItem( QIconSet( takePixmap( "delete" ) ), tr( "Remove contect" ),  this, SLOT( remove() ) );
	
	settings.endGroup();
	
	settings.beginGroup( "/roster" );
	
	setShowOffline( settings.readBoolEntry( "/showOffline", true ) );
	setShowAway( settings.readBoolEntry( "/showAway", true ) );
	
	settings.endGroup();
}
Example #21
0
void Yahoo::loadSettings ()
{
  QSettings settings;
  settings.beginGroup("/Qtstalker/Yahoo plugin");

  QString s = settings.readEntry("/Adjustment", "0");
  adjustment->setChecked(s.toInt());

  s = settings.readEntry("/Method", "History");
  setMethod(s);

  s = settings.readEntry("/Retries", "3");
  retrySpin->setValue(s.toInt());

  s = settings.readEntry("/Timeout", "15");
  timeoutSpin->setValue(s.toInt());

  s = settings.readEntry("/AllSymbols", "1");
  allSymbols->setChecked(s.toInt());
  allSymbolsChecked(s.toInt());

  settings.endGroup();
}
Example #22
0
void CDPWizard::pbtnOutputPath_clicked()
{
  QSettings myQSettings;
  QString myLastDir = myQSettings.readEntry("/qgis/cdpwizard/DefaultDirectories/OutputDir",QDir::homeDirPath());
  QString myFileNameQString;
  QFileDialog myFileDialog (myLastDir,"",this,"Select Output Directory");
  myFileDialog.setMode(QFileDialog::DirectoryOnly);
  if ( myFileDialog.exec() == QDialog::Accepted )
  {
    myFileNameQString = myFileDialog.selectedFile();
    leOutputPath->setText(myFileNameQString);
    myQSettings.writeEntry("/qgis/cdpwizard/DefaultDirectories/OutputDir",myFileNameQString);
  }
}
/*!
  Registers the component with id \a cid in the system component registry and
  returns TRUE if the component was registerd successfully, otherwise returns
  FALSE. The component is provided by the component server at \a filepath and
  registered with an optional \a name, \a version and \a description.

  This function does nothing and returns FALSE if a component with an identical
  \a cid does already exist on the system.

  A component that has been registered with a \a name can be created using both the
  \a cid and the \a name value using createInstance().

  Call this function for each component in an implementation of
  \link QComponentRegistrationInterface::registerComponents() registerComponents() \endlink.

  \sa unregisterComponent(), registerServer(), createInstance()
*/
bool QComponentFactory::registerComponent( const QUuid &cid, const QString &filepath, const QString &name, int version, const QString &description )
{
    bool ok = FALSE;
    QSettings settings;
    settings.insertSearchPath( QSettings::Windows, "/Classes" );

    QString cidStr = cid.toString().upper();
    settings.readEntry( "/CLSID/" + cidStr + "/InprocServer32/Default", QString::null, &ok );
    if ( ok ) // don't overwrite existing component
	return FALSE;

    ok = settings.writeEntry( "/CLSID/" + cidStr + "/InprocServer32/Default", filepath );
    if ( ok && !!description )
	settings.writeEntry( "/CLSID/" + cidStr + "/Default", description );

    // register the human readable part
    if ( ok && !!name ) {
	QString vName = version ? name + "." + QString::number( version ) : name;
	settings.writeEntry( "/CLSID/" + cidStr + "/ProgID/Default", vName );
	ok = settings.writeEntry( "/" + vName + "/CLSID/Default", cidStr );
	if ( ok && !!description )
	    settings.writeEntry( "/" + vName + "/Default", description );

	if ( ok && version ) {
	    settings.writeEntry( "/CLSID/" + cidStr + "/VersionIndependentProgID/Default", name );
	    QString curVer = settings.readEntry( "/" + name + "/CurVer/Default" );
	    if ( !curVer || curVer < vName ) { // no previous, or a lesser version installed
		settings.writeEntry( "/" + name + "/CurVer/Default", vName );
		ok = settings.writeEntry( "/" + name + "/CLSID/Default", cidStr );
		if ( ok && !!description )
		    settings.writeEntry( "/" + name + "/Default", description );
	    }
	}
    }

    return ok;
}
Example #24
0
void FLManagerModules::readState() {
  QSettings config;
  config.setPath( "InfoSiAL", "FacturaLUX", QSettings::User );
  QString keybase( "/facturalux/lite/" );
  QString idDB = "noDB";
  if ( db_->dbAux() )
    idDB = db_->dbAux() ->databaseName() + db_->dbAux() ->hostName() + db_->dbAux() ->userName() +
           db_->dbAux() ->driverName() + QString::number( db_->dbAux() ->port() );

  activeIdModule_ = config.readEntry( keybase + "Modules/activeIdModule/" + idDB, QString::null );
  activeIdArea_ = config.readEntry( keybase + "Modules/activeIdArea/" + idDB, QString::null );
  shaLocal_ = config.readEntry( keybase + "Modules/shaLocal/" + idDB, QString::null );
  staticDirFiles_ = config.readEntry( keybase + "Modules/staticDirFiles", QString::null );

#if defined (FL_QUICK_CLIENT)
  if ( activeIdModule_ == "sys" ) {
    activeIdModule_ = QString::null;
    activeIdArea_ = QString::null;
  }
#endif

  if ( activeIdModule_.isEmpty() || !listAllIdModules().contains( activeIdModule_ ) )
    setActiveIdModule( QString::null );
}
SpaceNavigatorPluginForm::SpaceNavigatorPluginForm( QWidget* parent /*= 0*/, const char* name /*= 0*/,
	WFlags fl /*= 0*/ )
	: SpaceNavigatorPluginFormBase( parent, name, fl )
{
	translationFactorSlider->setRange(0.01, 50.0);
	translationFactorSlider->setValue(10.0f);
	rotationFactorSlider->setRange(0.1, 2.0);
	rotationFactorSlider->setValue(1.0f);

	QSettings settings;
	settings.setPath("UFZ", "VRED-SpaceNavigatorPlugin");
	QString connectString = settings.readEntry("connectionString",
		QString("[email protected]"));
	vrpnDeviceLineEdit->setText(connectString);
}
//чтение настроек
void MainForm::readSettings()
{
	QSettings settings;
	settings.setPath("pku.ru", "ExecutionControl");
	settings.beginGroup("/ExecutionControl");
		settings.beginGroup("/geometry");
			int x = settings.readNumEntry("/x", 200);
			int y = settings.readNumEntry("/y", 200);
			int w = settings.readNumEntry("/width", 400);
			int h = settings.readNumEntry("/height", 200);
			move(x, y);
			resize(w, h);
		settings.endGroup();
		settings.beginGroup("/widthColumn");
			for(int col = 0; col < topicTable->numCols(); col++)
				topicTable->setColumnWidth(col, settings.readNumEntry("/" + QString::number(col), 150));
		settings.endGroup();
		settings.beginGroup("/connectDatabase");
			hostName = settings.readEntry("/hostname");
			userName = settings.readEntry("/username");
			password = settings.readEntry("/password");
		settings.endGroup();	
	settings.endGroup();
}
Example #27
0
void myQLoader::load_module_ex(const QString& name, bool module, const QString& nameModule, const QPixmap& pix)
{
  if(!module)
	{
	  worker->clearArguments();
	   //add code run program
	   
	  QStringList str = QStringList::split(" ",name);
	  
	   worker->setArguments(str);
	   
	   if(!worker->start());
	   		 
	}
	else
	{
		QLibrary lib(name);
		//add code run module
		
		QSettings settings;
		
		QString ApplicationPath; // = qApp->applicationDirPath();
		setAplDir(ApplicationPath);
	  
		QDir d = QDir::home();
  
		QString s1 = d.absPath();
	 
		settings.removeSearchPath( QSettings::Unix, s1+"/.qt");
		settings.insertSearchPath( QSettings::Unix, s1+"/.SCT" );
   
		QString slang = settings.readEntry("/SCT/Language_UI","en"); 
		
		QTranslator myapp( 0 );
		myapp.load( nameModule + "_" + slang, ApplicationPath+"/lang");
		qApp->installTranslator( &myapp );
	  	typedef  void (*showW)(const QPixmap& );
		showW shw = (showW)lib.resolve( "run_module" );
                		if ( shw )
                                  shw(pix);
		else
		  ;//QMessageBox::about(this,tr("Error"),tr("Can't load module"));
				
    	        lib.unload();
		//qApp->removeTranslator(&myapp);
	}
}
Example #28
0
void CDPWizard::loadDefaults()
{
    QSettings myQSettings;
    leMeanTemp->setText(myQSettings.readEntry("/qgis/cdpwizard/meanTemp"));
    leMinTemp->setText(myQSettings.readEntry("/qgis/cdpwizard/minTemp"));
    leMaxTemp->setText(myQSettings.readEntry("/qgis/cdpwizard/maxTemp"));
    leDiurnalTemp->setText(myQSettings.readEntry("/qgis/cdpwizard/diurnalTemp"));
    leMeanPrecipitation->setText(myQSettings.readEntry("/qgis/cdpwizard/meanPrecip"));
    leFrostDays->setText(myQSettings.readEntry("/qgis/cdpwizard/frostDays"));
    leTotalSolarRadiation->setText(myQSettings.readEntry("/qgis/cdpwizard/totalSolarRadiation"));


    QString myOutputDir = myQSettings.readEntry("/qgis/cdpwizard/DefaultDirectories/OutputDir",QDir::homeDirPath());
    leOutputPath->setText(myOutputDir);
    cboOutputFormat->setCurrentItem(myQSettings.readNumEntry("/qgis/cdpwizard/outputFormat"));


}
Example #29
0
void SRTPWrapper::printPolicyInfo(){
#ifdef SRTP	
	QSettings settings;
	cout << "SRTP Policy (RTP): " << endl;
	cout << "Key Exchange Mode: " << settings.readEntry(KStatics::dBase + "SRTP/Mode", "");
	cout << ", SSRC: " << policy->ssrc.value;
	cout << ", SSRC type : " << policy->ssrc.type << endl;
	cout << "cipherKeylengh: " << policy->rtp.cipher_key_len;
	cout << ", cypherType: " << policy->rtp.cipher_type << endl;
	cout << "AuthKeyLen: " << policy->rtp.auth_key_len;
	cout  << ", AuthType: " << policy->rtp.auth_type;
	cout  << ", AuthTagLengh: " << policy->rtp.auth_tag_len << endl;
	cout << "SRTP Master Key: " ;
	cout.setf(ios::hex, ios::basefield);
	for (int i=0; i < policy->rtp.cipher_key_len ; i++){
		cout <<	(short) policy->key[i];
	}
	cout << endl;
	cout.setf(ios::dec, ios::basefield);
#endif
}
Example #30
0
void qsa_eval_check()
{
  QSettings settings;
  settings.insertSearchPath(QSettings::Windows, "/Trolltech");
  QString key = QString("/QSA/%1/expdt").arg(QSA_VERSION_STRING);

  bool ok;
  bool showWarning = FALSE;
  QString str = settings.readEntry(key, QString::null, &ok);
  if (ok) {
    QRegExp exp("(\\w\\w\\w\\w)(\\w\\w)(\\w\\w)");
    Q_ASSERT(exp.isValid());
    if (exp.search(str) >= 0) {
      int a = exp.cap(1).toInt(0, 16);
      int b = exp.cap(2).toInt(0, 16);
      int c = exp.cap(3).toInt(0, 16);
      showWarning = (QDate::currentDate() > QDate(a, b, c));
    } else {
      showWarning = TRUE;
    }
  } else {
    QDate date = QDate::currentDate().addMonths(1);
    QString str = QString().sprintf("%.4x%.2x%.2x", date.year(), date.month(), date.day());
    settings.writeEntry(key, str);
  }

  if (showWarning) {
    QMessageBox::warning(0,
                         QObject::tr("End of Evaluation Period"),
                         QObject::tr("The evaluation period of QSA has expired.\n\n"
                                     "Please check http://www.trolltech.com/products/qsa"
                                     "for updates\n"
                                     "or contact [email protected] for further information"),
                         QMessageBox::Ok,
                         QMessageBox::NoButton);
  }
}