Parser::~Parser()
{
  QFile dotFile;
  if (dotFile.exists(m_dotFile)) dotFile.remove(m_dotFile);
  if (dotFile.exists(m_dotFile+".plain")) dotFile.remove(m_dotFile+".plain");
  dotFile.close();
}
Ejemplo n.º 2
0
void
aBackup::cleanupTmpFiles(const QString& tmpDirName, QStringList *files)
{
	QFile file;
	QDir dir;
	file.setName(QDir::convertSeparators(tmpDirName+"/content.xml"));
	aLog::print(aLog::Debug, tr("aBackup delete file %1").arg(file.name()));
	file.remove();
	file.setName(QDir::convertSeparators(tmpDirName+"/busines-schema.cfg"));
	aLog::print(aLog::Debug, tr("aBackup delete file %1").arg(file.name()));
	file.remove();
	file.setName(QDir::convertSeparators(tmpDirName+"/META-INF/manifest.xml"));
	aLog::print(aLog::Debug, tr("aBackup delete file %1").arg(file.name()));
	file.remove();
	for(uint i=0; i<files->count(); i++)
	{
			file.setName(QDir::convertSeparators(tmpDirName + "/templates/"+ (*files)[i]));
			aLog::print(aLog::Debug, tr("aBackup delete file %1").arg(file.name()));
			file.remove();
	}
	aLog::print(aLog::Debug, tr("aBackup delete directory %1").arg(tmpDirName + "/META-INF"));
	dir.rmdir(QDir::convertSeparators(tmpDirName + "/META-INF"));
	aLog::print(aLog::Debug, tr("aBackup delete directory %1").arg(tmpDirName + "/templates"));
	dir.rmdir(QDir::convertSeparators(tmpDirName + "/templates"));
	aLog::print(aLog::Debug, tr("aBackup delete directory %1").arg(tmpDirName));
	dir.rmdir(QDir::convertSeparators(tmpDirName));
	aLog::print(aLog::Info, tr("aBackup cleanup temporary files"));

}
Parser::~Parser()
{
  QFile fileHandler;
  if (fileHandler.exists(m_dotFile+".plain")) fileHandler.remove(m_dotFile+".plain");
  if (fileHandler.exists(m_dotFile) && m_lastErrorMsg.isEmpty()) fileHandler.remove(m_dotFile);
  fileHandler.close();
}
Ejemplo n.º 4
0
void Aleatorio::DeleteIndex(){

    QFile file; //borramos los ficheros
    file.setFileName(Path + "/index.dat");
    file.remove();
    file.setFileName(Path + "/radit.txt");
    file.remove();
    file.close();

 }
Ejemplo n.º 5
0
void MysqLoader::writeSettings()
{
	QFile autostartFile;

	LanguageTools language;

	QSettings mysqloader_conf(QSettings::NativeFormat,
							  QSettings::UserScope, APP_NAME);
	mysqloader_conf.beginGroup("MySQLoader");
	mysqloader_conf.setValue("Autostart",
							 autostartCheckBox->isChecked());
	mysqloader_conf.setValue("Desktop_Icon",
							 desktopIconCheckBox->isChecked());
	mysqloader_conf.setValue("Set_Language",
							 languageGroup->isChecked());
	mysqloader_conf.setValue("languageNiceName",
							 languageCombo->currentText());
	mysqloader_conf.setValue("languageFileName",
							 fileToNiceName->value(
								 languageCombo->currentText()));
	mysqloader_conf.setValue("Meldung",
							 showMeldungCheckBox->isChecked());
	mysqloader_conf.setValue("Meldung_App",
							 meldungAppCheckBox->isChecked());
	mysqloader_conf.setValue("Zeige_Fenster",
							 showDialogCheckBox->isChecked());
	mysqloader_conf.endGroup();

	mysqloader_conf.beginGroup("MySQL_Paths");
	mysqloader_conf.setValue("MySQL_PID_FILE",
							 pidFileEdit->text());
	mysqloader_conf.setValue("MySQL_Server",
                             mysqlEdit->text());
	mysqloader_conf.endGroup();



	if (autostartCheckBox->isChecked() == true) {
		autostartFile.copy("/usr/share/applications/mysqloader.desktop",
						   QDir::homePath() +
						   "/.config/autostart/mysqloader.desktop");
	} else {
		autostartFile.remove(QDir::homePath() +
							 "/.config/autostart/mysqloader.desktop");
	}

	if (desktopIconCheckBox->isChecked() == true) {
		autostartFile.copy("/usr/share/applications/mysqloader.desktop",
						   QDir::homePath() +
						   "/Desktop/mysqloader.desktop");
	} else {
		autostartFile.remove(QDir::homePath() +
							 "/Desktop/mysqloader.desktop");
	}
}
Ejemplo n.º 6
0
/*
 * 	LoadData class constuctor
 * 	Inputs: parent, QString fileInput
 * 	Constructor takes in a route number as fileInput, such as fileInput = 10
 *	and looks for a file with name route10.xml. If it's not found, it lets caller
 *	know to create it, and if it is found it loads up specified station and time info.
 */
LoadData::LoadData(QObject* parent, QString fileInput) {
	buses.clear();
	stations.clear();
	failFlag = false; //Fail flag set to true if file is not found
	QString fileName = "route" + fileInput + ".xml";
	//Open file in specified folder with inputted file name
	QString appFolder(QDir::currentPath());
	QString fileExtension = appFolder + "/app/native/assets/schedule/"
			+ fileName;
	QFile *file = new QFile(fileExtension);

	if (!file->open(QIODevice::ReadOnly | QIODevice::Text)) {
		//qDebug() << "Failed to open " + fileName;
		//Now download file...
		failFlag = true;
		return;
	}
	qDebug() << "Start load data: " + fileName;
	QDomDocument doc("route"); //Get the root node, route
	QString bl = "h";
	QString *errorMsg = &bl;
	//If the xml file is corrupted & doesn't have root node "route", then redownload file.
	if (!doc.setContent(file, true, errorMsg)) {
		////qDebug() << "I failed to open " + fileName;
		file->close();
		//Delete file, redownload
		file->remove();
		failFlag = true;
		return;
	}
	file->close();
	root = doc.documentElement(); //Setup root node

}
Ejemplo n.º 7
0
QString CDTpAvatarUpdate::writeAvatarFile(QFile &avatarFile)
{
    if (not mCacheDir.exists() && not QDir::root().mkpath(mCacheDir.absolutePath())) {
        warning() << "Could not create large avatar cache dir:" << mCacheDir.path();
        return QString();
    }

    QTemporaryFile tempFile(mCacheDir.absoluteFilePath(QLatin1String("pinkpony")));
    const QByteArray data = mNetworkReply->readAll();

    if (tempFile.open() && data.count() == tempFile.write(data)) {
        tempFile.close();

        if (avatarFile.exists()) {
            avatarFile.remove();
        }

        if (tempFile.rename(avatarFile.fileName())) {
            tempFile.setAutoRemove(false);
            return avatarFile.fileName();
        }
    }

    return QString();
}
Ejemplo n.º 8
0
void janelaPrincipal::copiarAquivos(QFile &origem, QFile &destino)
{

    qint64 nCopySize = origem.size();
    ui->progressBarGeral->setMaximum(nCopySize);
    if(!(origem.open(QFile::ReadOnly) && destino.open(QFile::ReadWrite))){
        return;
    }


  qDebug() << QString::number(nCopySize)+" o tamanho do arquivo";
  //dialog->show();

     for (qint64 i = 0; i < nCopySize; i += 1024*1024) {
         if(iscopy){
         destino.write(origem.read(i)); // write a byte
         destino.seek(i);  // move to next byte to read
         origem.seek(i); // move to next byte to write
         ui->progressBarGeral->setValue(i);
    }else {
             destino.remove();
             break;
         }

         // ui->progressBarGeral->;
     }
     ui->progressBarGeral->setVisible(false);
     ui->progressBarGeral->setValue(0);
      modeldir->refresh();
}
Ejemplo n.º 9
0
void DialogVarConfig::guardar()
{
    QStringList retorno;
    retorno<<ui->txt1->text();
    retorno<<ui->txt2->currentText();
    retorno<<ui->txt3->text();
    retorno<<ui->txt4->text();
    retorno<<ui->txt5->text();
    retorno<<ui->txt6->text();
    retorno<<ui->txt7->text();
    retorno<<ui->txt8->text();
    retorno<<ui->txt9->text();
    retorno<<ui->txt10->text();
    if(estado == 2){
        datos.append(retorno.join(":::"));
    } else if(estado == 1){
        datos.removeAt(index);
        datos.append(retorno.join(":::"));
    }
    QFile f;
    f.setFileName("scriptsconfig");
    f.remove();
    f.open(QIODevice::WriteOnly);
    f.write(datos.join("\n").toLatin1());
    f.waitForBytesWritten(0);
    f.close();
}
Ejemplo n.º 10
0
bool TextHelper::writeBatteryPar(QString batteryPar)
{
    QFile *dtsFile = new QFile(Global::srcPath + "/" + Global::dtsPath);
    QFile *tempFile = new QFile(QDir::currentPath() + "/tmp/temp.txt");
    QTextStream dtsTS(dtsFile);
    QTextStream tempTS(tempFile);
    if(!dtsFile->open(QIODevice::ReadOnly))
    {
        qDebug() << Global::srcPath + "/" + Global::dtsPath << " open fail";
        return false;
    }
    if(!tempFile->open(QIODevice::WriteOnly))
    {
        qDebug() << QDir::currentPath() + "/tmp/temp.txt" << " open fail";
        dtsFile->close();
        return false;
    }
    QString strLine;
    while (!dtsTS.atEnd())
    {
        strLine = dtsTS.readLine();
        if(strLine.contains("battery {"))
        {
            tempTS << strLine << "\n";
            strLine = dtsTS.readLine();
            tempTS << strLine << "\n";
            tempTS << "      ocv_table = <";
            QStringList strList = batteryPar.trimmed().split(" ");
            for(int i = 1; i < 21; i++)
            {
                tempTS << strList[i -1] << " ";
                if(i%7 == 0)
                {
                    tempTS << "\n\t\t\t";
                }
            }
            tempTS << strList[20];
            tempTS << ">;\n";
            dtsTS.readLine();
            dtsTS.readLine();
            dtsTS.readLine();
            continue;
        }
        tempTS << strLine << "\n";
    }
    dtsFile->close();
    tempFile->flush();
    tempFile->close();
    if(!dtsFile->remove())
    {
        qDebug() << "dtsFile remove fail";
        return false;
    }
    if(!tempFile->copy(Global::srcPath + "/" + Global::dtsPath))
    {
        qDebug() << "copy fail" << Global::srcPath + "/" + Global::dtsPath;
        return false;
    }
    return true;
}
Ejemplo n.º 11
0
void DialogConfigBooks::on_toolButtonOPenGroup_clicked()
{
    QFileDialog dlg;
QString homeDir=QDir::homePath () ;
    QString fn = dlg.getOpenFileName(0, tr("Open xml Files..."),
                                              homeDir   , trUtf8("ملف قائمة الكتب (group.xml );;xml (group.xml)"));
   qDebug()<<fn;
    if(!dlg.AcceptOpen)
     //   return;

    if (!fn.isEmpty())
    {

        QString groupPath=QDir::homePath()+"/.kirtasse/data/group.xml";
        QString groupPathNew=QDir::homePath()+"/.kirtasse/data/group.xml.old";
        QFile file;
        if(file.exists(groupPathNew))
            file.remove(groupPathNew);

        if(file.rename(groupPath,groupPathNew)) {
            if(file.copy(fn,groupPath)){
                Messages->treeChargeGroupe( ui->treeWidgetBooks,0,true);
                     ui->lineEditGroup->setText(fn);
                     ui->toolButtonGroupUpdat->setEnabled(true);
            }
        }
        if(ui->treeWidgetBooks->topLevelItemCount()<1)
           on_toolButtonGroupUpdat_clicked();
    }
}
Ejemplo n.º 12
0
void QtDcmPreferences::writeSettings()
{
    //Remove settings file
    QFile ini ( d->iniFile.fileName() );
    ini.remove();
    //Instantiate a QSettings object with the ini file.
    QSettings prefs ( d->iniFile.fileName(), QSettings::IniFormat );
    //Write local settings from the private attributes
    prefs.beginGroup ( "LocalSettings" );
    prefs.setValue ( "AETitle", d->aetitle );
    prefs.setValue ( "Port", d->port );
    prefs.setValue ( "Hostname", d->hostname );
    prefs.endGroup();

    prefs.beginGroup ( "Converter" );
    prefs.setValue ( "Dcm2nii", d->dcm2niiPath );
    prefs.setValue ( "UseDcm2nii", d->useDcm2nii );
    prefs.endGroup();

    //Do the job for each server
    prefs.beginGroup ( "Servers" );
    for ( int i = 0; i < d->servers.size(); i++ )
    {
        prefs.beginGroup ( "Server" + QString::number ( i + 1 ) );
        prefs.setValue ( "AETitle", d->servers.at ( i )->getAetitle() );
        prefs.setValue ( "Hostname", d->servers.at ( i )->getServer() );
        prefs.setValue ( "Port", d->servers.at ( i )->getPort() );
        prefs.setValue ( "Name", d->servers.at ( i )->getName() );
        prefs.endGroup();
    }

    prefs.endGroup();

    emit preferencesUpdated();
}
Ejemplo n.º 13
0
bool DataManager::deleteFile(int index)
{
    QFile* file = m_fileVec.at(index);
    if( file && file->remove() )
        return true;
    return false;
}
Ejemplo n.º 14
0
/*
 * Move the images to the images folder.
 */
bool relocateImages(void)
{
	bool status = 1;
	QStringList filters;
	filters << "*.png";

	fileDir[ROOT]->setNameFilters(filters);
	QDirIterator iterator(*fileDir[ROOT]);
	QFile *file;
	QString *name;

	while(iterator.hasNext() && status)
	{
		file = new QFile(iterator.next());
		name = new QString(file->fileName());
		name->remove(0, 
		     name->lastIndexOf(QString(fileDir[ROOT]->separator()))+1);
		status = file->copy(fileDir[IMAGES]->absolutePath() +
			fileDir[IMAGES]->separator() + *name);
		file->remove();
		delete file;
		delete name;
	}

	return status;
}
Ejemplo n.º 15
0
void FaceTrackNoIR::saveAs()
{
    looping++;
	QSettings settings("opentrack");
	QString oldFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString();

	QString fileName = QFileDialog::getSaveFileName(this, tr("Save file"),
													oldFile,
                                                    tr("Settings file (*.ini);;All Files (*)"));
	if (!fileName.isEmpty()) {

		QFileInfo newFileInfo ( fileName );
		if ((newFileInfo.exists()) && (oldFile != fileName)) {
			QFile newFileFile ( fileName );
			newFileFile.remove();
		}

		QFileInfo oldFileInfo ( oldFile );
		if (oldFileInfo.exists()) {
			QFile oldFileFile ( oldFile );
			oldFileFile.copy( fileName );
		}

		settings.setValue ("SettingsFile", fileName);
        save();
    }

    looping--;
    fill_profile_cbx();
}
Ejemplo n.º 16
0
/*!
*	\en
*	Gets name for new template. Need for OpenOffice v2.
*	\_en
*	\ru
*	Получение имени для нового шаблона. Нужна из-за блокировок в OpenOffice v2.
*	\_ru
*/
QString
aReport::getName4NewTemplate()
{
	uint count=0;
	QFile tmpf;
	QString suff = ".odt";
	QString fname;
	if(type==RT_office_calc) suff = ".ods";
	if(type==RT_msoffice_word || type==RT_msoffice_excel) suff = ".xml";
	do
	{
		// tpl->getDir() должно заканчиваться на /
		fname =  QDir::convertSeparators(QString(tpl->getDir()+".ananas-report%1%2").arg(count).arg(suff));
		tmpf.setName(fname);
		if(tmpf.exists())
		{
			if(tmpf.remove()) break;
			else ++count;
		}
		else
		{
			break;
		}
	}while(count<100);

	aLog::print(aLog::MT_DEBUG, tr("aReport: name for template = %1").arg(fname));
	return fname;
}
Ejemplo n.º 17
0
void BusinessCardHandling::saveAvatar(const QString filename, QPixmap p, QContact& contact)
{

    // Path to store avatar picture
    QString path;
#ifdef Q_OS_SYMBIAN
    path.append("c:/System/");
#endif
    path.append(filename);

    // Remove same file if exists
    QFile file;
    if (file.exists(path))
        file.remove(path);

    // Save pixmap into file
    bool saveRet = p.save(path);

    if (saveRet) {
        // Create avatar
        QContactAvatar contactAvatar;
        contactAvatar.setImageUrl(QUrl(path));
        bool saveAvatar = contact.saveDetail(&contactAvatar);

        // Save contact
        if (saveAvatar)
            m_contactManager->saveContact(&contact);

        // NOTE: Do not remove picture, system needs it for showing avatar
        // Remove picture file
        //bool removeRet = file.remove(path);
    }
}
Ejemplo n.º 18
0
bool FileSystem::moveFile(const QString &locationTo,
                          const QString &locationFrom)
{
//    QImage img(getCurrentAbsoluteFileName());
//    bool success;
//    if(SaveConfirmation::imageWasChanged(getCurrentAbsoluteFileName()))
//    {
//        img = SaveConfirmation::getChagedImage(getCurrentAbsoluteFileName());
//        success = img.save(locationForSaving);
//        if(success)
//            SaveConfirmation::deleteImage(getCurrentAbsoluteFileName());
//    }
//    else
//        success = img.save(locationForSaving);

    QFile file;
    if(file.exists(locationTo))
        file.remove(locationTo);

    bool success = file.copy(locationFrom, locationTo);
    if(success)
        SaveConfirmation::deleteImage(locationTo);

    return success;
}
Ejemplo n.º 19
0
void MagicalObjectWindow::on_removeButton_clicked()
{
    QItemSelectionModel *selection = ui->treeViewExistingObjects->selectionModel();
    QModelIndex indexElementSelectionne = selection->currentIndex();

    if(indexElementSelectionne.isValid())
    {
        int rep = QMessageBox::question(this,tr("Effacer"),
                                        tr("Voulez-vous vraiment effacer cet object magique ?"),
                                        QMessageBox::Yes | QMessageBox::No);
        if (rep == QMessageBox::Yes)
        {
            QFile f;
            f.setFileName(MAGICAL_OBJECT_PATH + "/" + ui->comboRace->currentText() + "/" + objects->item(indexElementSelectionne.row(), 0)->text() + ".om");
            f.remove();
            updateTreeView(ui->comboRace->currentText());
        }
        else if (rep == QMessageBox::No)
        {
            QMessageBox::critical(this, tr("Annulation"), tr("Opération annulée"));
        }
    }
    else
    {
        QMessageBox::warning(this, tr("Info"), tr("Veuillez sélectionner un régiment a supprimer."));
    }
}
Ejemplo n.º 20
0
void BootOptionsDialog::accept()
{
    QDir dir;
    QFile file;
    QStringList filters;
    QStringList allFiles;
    QString fileName;

    if(m_ui->atariDOS->isChecked()) selectedDOS = "$bootata";
    if(m_ui->myDOS->isChecked()) selectedDOS = "$bootmyd";
    if(m_ui->dosXL->isChecked()) selectedDOS = "$bootdxl";
    if(m_ui->smartDOS->isChecked()) selectedDOS = "$bootsma";
    if(m_ui->spartaDOS->isChecked()) selectedDOS = "$bootspa";
    if(m_ui->myPicoDOS->isChecked()) {
        selectedDOS = "$bootpic";
        g_disablePicoHiSpeed = m_ui->disablePicoHiSpeed->isChecked();
    }

    bootDir = g_respeQtAppPath + "/" + selectedDOS;

    // First delete existing boot files in the Folder Image
    // then copy new boot files from the appropriate DOS directory

    dir.setPath(bootFolderPath_);
    filters << "*dos.sys" << "dup.sys" << "dosxl.sys"
            << "autorun.sys" << "ramdisk.com" << "menu.com"
            << "startup.exc" << "x*.dos" << "startup.bat" << "$*.bin";
    allFiles =  dir.entryList(filters, QDir::Files);
    foreach(fileName, allFiles) {
        file.remove(bootFolderPath_ + "/" + fileName);
    }
Ejemplo n.º 21
0
void FilePersistThread::rollFileIfNecessary(QFile& file, bool notifyListenersIfRolled) {
    uint64_t now = usecTimestampNow();
    if ((file.size() > MAX_LOG_SIZE) || (now - _lastRollTime) > MAX_LOG_AGE_USECS) {
        QString newFileName = getLogRollerFilename();
        if (file.copy(newFileName)) {
            file.open(QIODevice::WriteOnly | QIODevice::Truncate);
            file.close();
            qDebug() << "Rolled log file:" << newFileName;

            if (notifyListenersIfRolled) {
                emit rollingLogFile(newFileName);
            }

            _lastRollTime = now;
        }
        QStringList nameFilters;
        nameFilters << FILENAME_WILDCARD;

        QDir logQDir(FileUtils::standardPath(LOGS_DIRECTORY));
        logQDir.setNameFilters(nameFilters);
        logQDir.setSorting(QDir::Time);
        QFileInfoList filesInDir = logQDir.entryInfoList();
        qint64 totalSizeOfDir = 0;
        foreach(QFileInfo dirItm, filesInDir){
            if (totalSizeOfDir < MAX_LOG_DIR_SIZE){
                totalSizeOfDir += dirItm.size();
            } else {
                QFile file(dirItm.filePath());
                file.remove();
            }
        }
    }
Ejemplo n.º 22
0
void ConfigFile::DeleteOldFileIfExists(QString filename)
{
    QFile *file = new QFile(filename);
    if (!file->open(QIODevice::ReadWrite|QIODevice::Text))
        return;
    file->remove();
    file->close();
}
Ejemplo n.º 23
0
void Cmap_button::delete_attempt()
{
    QMessageBox msg;
    msg.setText( tr( "Are you really sure that you want to delete " )
                 + this->text + tr( " ?" ) );
    msg.addButton( tr( "Delete" ), QMessageBox::AcceptRole );
    msg.addButton( tr( "Cancel" ), QMessageBox::RejectRole );
    if ( msg.exec() == QDialog::Rejected )
    {
        //remove map files
        QFile f;
        f.remove( this->absolute_map_path );
        f.remove( this->absolute_map_path + ".preview" );
    }

    QTimer::singleShot( 500, this, SIGNAL(please_refresh_as_we_deleted_something()) );
}
Ejemplo n.º 24
0
void jsBridge::removeTmpFile()
{
    if (files.isEmpty())
        return;
    QFile *tmpf = files.dequeue();
    tmpf->remove();
    delete tmpf;
}
Ejemplo n.º 25
0
Member::~Member()
{
    QFile file(a_file);
    file.remove();

    QString cheminPictures(a_filePictures);
    QFile filePictures (cheminPictures);
    filePictures.remove();
}
Ejemplo n.º 26
0
int main(int argc, char ** argv)
{
    //Setup any pre-QApplication initialization values
    LXDG::setEnvironmentVars();
    setenv("DESKTOP_SESSION","LUMINA",1);
    setenv("XDG_CURRENT_DESKTOP","LUMINA",1);
    //Check is this is the first run
    bool firstrun = false;
    if(!QFile::exists(logfile.fileName())){ firstrun = true; }
    //Setup the log file
    qDebug() << "Lumina Log File:" << logfile.fileName();
    if(logfile.exists()){ logfile.remove(); } //remove any old one
      //Make sure the parent directory exists
      if(!QFile::exists(QDir::homePath()+"/.lumina/logs")){
        QDir dir;
        dir.mkpath(QDir::homePath()+"/.lumina/logs");
      }
    logfile.open(QIODevice::WriteOnly | QIODevice::Append);
    //Startup the Application
    LSession a(argc, argv);
    //Setup Log File
    qInstallMsgHandler(MessageOutput);
    //Setup the QSettings
    QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, QDir::homePath()+"/.lumina/settings");
    qDebug() << "Initializing Lumina";
    //Start up the Window Manager
    qDebug() << " - Start Window Manager";
    WMProcess WM;
    WM.startWM();
    QObject::connect(&WM, SIGNAL(WMShutdown()), &a, SLOT(closeAllWindows()) );
    //Load the initial translations
    QTranslator translator;
    QLocale mylocale;
    QString langCode = mylocale.name();
    
    if ( ! QFile::exists(PREFIX + "/share/Lumina-DE/i18n/lumina-desktop_" + langCode + ".qm" ) )  langCode.truncate(langCode.indexOf("_"));
    translator.load( QString("lumina-desktop_") + langCode, PREFIX + "/share/Lumina-DE/i18n/" );
    a.installTranslator( &translator );
    qDebug() << "Locale:" << langCode;
    //Now start the desktop
    QDesktopWidget DW;
    QList<LDesktop*> screens;
    for(int i=0; i<DW.screenCount(); i++){
      qDebug() << " - Start Desktop " << i;
      screens << new LDesktop(i);
      a.processEvents();
    }
    qDebug() << " --exec";
    int retCode = a.exec();
    qDebug() << "Stopping the window manager";
    WM.stopWM();
    qDebug() << "Finished Closing Down Lumina";
    logfile.close();
    return retCode;
}
Ejemplo n.º 27
0
ExchangeFile::ExchangeFile()
{
    QFile exFile;
    exFile.setFileName("Message.txt");
    if(exFile.size() == 0){
        exFile.remove();
        return;
    }else{
        exFile.close();
    }
    QSettings settings("AO_Batrakov_Inc.", "EmployeeClient");
    QString fileName = settings.value("numprefix").toString();
    fileName += "_SRV.txt";

    qDebug()<<exFile.rename(fileName);
    exFile.close();

    qDebug()<<exFile.isOpen()<<" - "<<exFile.fileName()<<fileName;

    QString fN = exFile.fileName();

    PutFile putFile;
    putFile.putFile(fN);

    PutFile putFtp1;
    QString nullFileName = "Null.txt";
    //nullFileName += fN;
    QFile nullFile;
    nullFile.setFileName(nullFileName);
    nullFile.open(QIODevice::WriteOnly);
    QByteArray rr = "22\n10";
    nullFile.write(rr);
    nullFile.close();
    putFtp1.putFile(nullFileName);
    nullFile.remove();

    QFile file;

    file.setFileName("null.txt");
    file.remove();
}
Ejemplo n.º 28
0
bool Desk::writeDesk (void)
   {
   QFile file;
   QString fname;

   // remove any old file
   fname = _dir + "/maxdesk.ini";
   file.setName (fname);
   if (file.exists ())
      file.remove ();
   fname = _dir + "/MaxDesk.ini";
   file.setName (fname);
   if (file.exists ())
      file.remove ();
   file.setName (_dir + DESK_FNAME);
   if (file.exists ())
      file.remove ();

   QTextStream stream( &file );
   QString line;

   if (!file.open (QIODevice::WriteOnly))
      return false;

   // write header
   stream << "[DesktopFile]" << endl;
   stream << "File=" << endl;
   stream << endl;
   stream << "[Folder]" << endl;
   stream << "Version=0x00060000" << endl;
   stream << endl;

   stream << "[Files]" << endl;

   // output the file list
   foreach (File *f, _files)
      f->encodeFile (stream);

   _dirty = false; // we are clean again
   return true;
   }
Ejemplo n.º 29
0
void DialogVarConfig::eliminar()
{
    datos.removeAt(index);
    QFile f;
    f.setFileName("scriptsconfig");
    f.remove();
    f.open(QIODevice::WriteOnly);
    f.write(datos.join("\n").toLatin1());
    f.waitForBytesWritten(0);
    f.close();
    cargarDatos();
}
Ejemplo n.º 30
0
/**
\param bcont
**/
int BcBulmaCont_closeEvent ( BcBulmaCont *bcont )
{
    BcCompany *company = bcont->company();
    QFile file ( g_confpr->value( CONF_DIR_USER ) + "pluginbc_corrector_" + company->dbName() + ".cfn" );
    if ( !viewCorrector->isChecked() ) {
        file.remove();
    } else {
        file.open ( QIODevice::WriteOnly );
        file.close();
    } // end if
    return 0;
}