void installDistribution(std::string distToInstall){ guiInfoBox(gStr("STR_FIRST_RUN_EXTRACT")); std::string response = systemCallResponse("cd data/texlive; unzip " + distToInstall); guiCloseDialog(); if(!response.substr(0,7).compare("Archive")){ guiAlert(gStr("STR_ADDDIST_SUCCESS")); }else{ guiAlert(response); }; }
int firstRunComplete(){ systemCallResponse("touch data/firstruncomplete" + getVersion()); fprintf(stderr,"Completed first run tasks...\n"); guiAlert(gStr("STR_FIRST_RUN_INST_REQ")); return 0; }
void Settings::initListOfAccounts() { QStringList listAcc = this->getListAccounts(); alm->takeRows( 0, alm->count() ); QStringList::const_iterator itr = listAcc.begin(); int i = 0; while ( itr != listAcc.end() ) { QString grid = *itr; itr++; QString name = gStr(grid,"name"); QString icon = gStr(grid,"icon"); QString jid = gStr(grid,"jid"); QString passwd = gStr(grid,"passwd"); QString host = gStr(grid,"host"); int port = gInt(grid,"port"); QString resource = gStr(grid,"resource"); bool isManuallyHostPort = gBool(grid,"use_host_port"); AccountsItemModel *aim = new AccountsItemModel( grid, name, icon, jid, passwd, resource, host, port, isManuallyHostPort, this ); alm->append(aim); i++; } emit accountsListChanged(); }
int saveLog(std::string logdata){ logdata = systemCallResponse("date") + "\n-----Log-----\n" + logdata; FILE * logFile; logFile = fopen ("$HOME/../tmp/log.txt","w"); if (logFile!=NULL) { fprintf(logFile,"%s",logdata.c_str()); fclose (logFile); return 0; }else { guiAlert(gStr("STR_LOG_WRITE_FAIL")); } return 1; }
int showLog(){ int endState = 1; std::string logdata= ""; FILE * logFile; logFile = fopen ("$HOME/../tmp/log.txt","r"); if (logFile!=NULL) { endState = 0; char buffer[80]; while( fgets( buffer, 80, logFile ) != NULL ) { logdata += buffer; } fclose(logFile); }else { logdata = gStr("STR_LOG_READ_FAIL"); } guiAlert(logdata); return endState; }
int firstRunTasks(){ systemCallResponse("cp app/native/appSettings-default.txt data/appSettings.txt"); guiInfoBox(gStr("STR_FIRST_RUN_RUNNING") + " -> " + gStr("STR_FIRST_RUN_MOVE")); std::string output =systemCallResponse("cp -rf app/native/texlive data/"); fprintf(stderr,"%s\n",output.c_str()); guiCloseDialog(); guiInfoBox(gStr("STR_FIRST_RUN_RUNNING") + " -> " + gStr("STR_FIRST_RUN_EXTRACT")); output = systemCallResponse("cd data/texlive; ls *.zip | while read x;do echo ${x%.zip};rm -Rf ${x%.zip}; unzip $x; done"); fprintf(stderr,"%s\n",output.c_str()); guiCloseDialog(); guiInfoBox(gStr("STR_FIRST_RUN_RUNNING") + " -> " + gStr("STR_FIRST_RUN_REMOVE")); output = systemCallResponse("ls data/texlive/*.zip | while read x; do rm $x; done"); fprintf(stderr,"%s\n",output.c_str()); guiCloseDialog(); setTexBin("otgtexlive-2012basic"); return 0; }