void PreFlightWidget::slotReject() { setVisible( false ); GeneralConfig::instance()->setClosePreFlightMenu( m_menuCb->checkState() == Qt::Checked ? true : false ); emit closeConfig(); // Make a delay of 200 ms before the widget is closed to prevent undesired // selections in an underlaying list. Problem occurred on Galaxy S3. QTimer::singleShot(200, this, SLOT(close())); }
QueryData genAptSrcs(QueryContext& context) { QueryData results; // Load our apt configuration into memory // Note: _config comes from apt-pkg/configuration.h // _system comes from apt-pkg/pkgsystem.h pkgInitConfig(*_config); if (pkgInitSystem(*_config, _system) == false) { return results; } pkgCacheFile cache_file; pkgCache* cache = cache_file.GetPkgCache(); pkgSourceList* src_list = cache_file.GetSourceList(); if (cache == nullptr || src_list == nullptr) { cache_file.Close(); closeConfig(); return results; } // For each apt cache file that contains packages for (pkgCache::PkgFileIterator file = cache->FileBegin(); file && !file.end(); ++file) { // Locate the associated index files to ensure the repository is installed pkgIndexFile* pkgIndex; if (!src_list->FindIndex(file, pkgIndex)) { continue; } extractAptSourceInfo(file, pkgIndex, results); } // Cleanup cache_file.Close(); closeConfig(); return results; }
/*! \brief \fn cdegs_main::connectSlots */ void cdegs_main::connectSlots(){ QObject::connect(ui->actionNew_Project, SIGNAL(triggered()), this, SLOT(newProject())); QObject::connect(ui->actionNew_Config, SIGNAL(triggered()), this, SLOT(newConfig())); QObject::connect(ui->actionOpen_Project, SIGNAL(triggered()), this, SLOT(openProject())); QObject::connect(ui->actionSave_Project, SIGNAL(triggered()), this, SLOT(saveProject())); QObject::connect(ui->actionSave_Project_as, SIGNAL(triggered()), this, SLOT(saveProjectAs())); QObject::connect(ui->actionClose_Project, SIGNAL(triggered()), this, SLOT(closeProject())); QObject::connect(ui->tabProjects, SIGNAL(currentChanged(int)), this, SLOT(changeTab())); QObject::connect(ui->tabProjects, SIGNAL(tabCloseRequested(int)), this, SLOT(closeProject(int))); QObject::connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(about())); QObject::connect(ui->actionStylesheet, SIGNAL(triggered()), this, SLOT(openStyleDialog())); QObject::connect(ui->actionOpen_Config, SIGNAL(triggered()), this, SLOT(openConfigDialog())); QObject::connect(ui->actionSave_Config, SIGNAL(triggered()), this, SLOT(saveConfig())); QObject::connect(ui->actionClose_Config, SIGNAL(triggered()), this, SLOT(closeConfig())); QObject::connect(ui->actionExport_Config, SIGNAL(triggered()), this, SLOT(exportConfig())); QObject::connect(ui->actionExport_Config_as, SIGNAL(triggered()), this, SLOT(exportConfigAs())); QObject::connect(ui->actionSave_All_Configs, SIGNAL(triggered()), this, SLOT(saveAllConfigs())); }
void systemShutdown(void) { pie_ShutdownRadar(); if (mod_list) { free(mod_list); } shutdownEffectsSystem(); wzSceneEnd("Main menu loop"); keyClearMappings(); // free up all the load functions (all the data should already have been freed) resReleaseAll(); if (!multiShutdown()) // ajl. init net stuff { debug(LOG_FATAL, "Unable to multiShutdown() cleanly!"); abort(); } debug(LOG_MAIN, "shutting down audio subsystems"); debug(LOG_MAIN, "shutting down CD audio"); cdAudio_Close(); if ( audio_Disabled() == false && !audio_Shutdown() ) { debug(LOG_FATAL, "Unable to audio_Shutdown() cleanly!"); abort(); } debug(LOG_MAIN, "shutting down graphics subsystem"); levShutDown(); widgShutDown(); fpathShutdown(); mapShutdown(); debug(LOG_MAIN, "shutting down everything else"); pal_ShutDown(); // currently unused stub frameShutDown(); // close screen / SDL / resources / cursors / trig screenShutDown(); closeConfig(); // "registry" close cleanSearchPath(); // clean PHYSFS search paths debug_exit(); // cleanup debug routines PHYSFS_deinit(); // cleanup PHYSFS (If failure, state of PhysFS is undefined, and probably badly screwed up.) // NOTE: Exception handler is cleaned via atexit(ExchndlShutdown); }
i4 main (int argc, char **argv) { STATUS status=OK; PTR drvH=NULL; char **list=NULL; ATTR_ID **attrList=NULL; char **defAttr=NULL; i4 count=0, attrCount = 0, retcount; i4 i; bool badCmdLine = FALSE, rmPkg = FALSE, has_default = FALSE, has_alt = FALSE, isReadOnly = FALSE, mgrSpecified = FALSE, batch = FALSE, def_or_alt=FALSE; i4 pathType = OCFG_SYS_PATH; char altPath[OCFG_MAX_STRLEN] = "\0"; char drvMgr[OCFG_MAX_STRLEN] = "\0"; char line[MAXLINE],prompt[MAXLINE]; char driverPath[OCFG_MAX_STRLEN]; char *dirPath; char driverName[OCFG_MAX_STRLEN]; char *ii_installation; char *p = NULL; char custName[OCFG_MAX_STRLEN]; char etxt[512]; ATTR_ID driverList[6] = { { DRV_ATTR_DRIVER, "\0" }, { DRV_ATTR_DRIVER_ODBC_VER, DRV_STR_VERSION }, { DRV_ATTR_DRIVER_READONLY, DRV_STR_N }, { DRV_ATTR_DRIVER_TYPE, DRV_STR_INGRES }, { DRV_ATTR_VENDOR, DRV_STR_INGRES_CORP }, { DRV_ATTR_DONT_DLCLOSE, DRV_STR_ONE } }; int drvCount = sizeof(driverList) / sizeof(driverList[0]); ATTR_ID **drvList = (ATTR_ID **)MEreqmem( (u_i2) 0, (u_i4)drvCount, TRUE, (STATUS *) NULL); for (i = 0; i < drvCount; i++) { drvList[i] = (ATTR_ID *)MEreqmem( (u_i2) 0, (u_i4)sizeof(ATTR_ID), TRUE, (STATUS *) NULL); drvList[i]->id = driverList[i].id; drvList[i]->value = (char *)MEreqmem( (u_i2) 0, (u_i4)OCFG_MAX_STRLEN, TRUE, (STATUS *) NULL); STcopy(driverList[i].value, drvList[i]->value); } if ( argc > 7 ) badCmdLine = TRUE; /* ** Parse the command line. Reject invalid arguments. */ if ( !badCmdLine && argc > 1 ) { if (checkArgs("-h", argc, argv, NULL, NULL ) ) { display_help(); PCexit(0); } if (checkArgs("-help", argc, argv, NULL, NULL ) ) { display_help(); PCexit(0); } if ( checkArgs("-batch", argc, argv, NULL, NULL ) ) batch = TRUE; if ( checkArgs("-rmpkg", argc, argv, NULL, NULL ) ) rmPkg = TRUE; if (checkArgs("-r", argc, argv, NULL, NULL ) ) isReadOnly = TRUE; if ( checkArgs("-p", argc, argv, altPath, NULL ) ) pathType = OCFG_ALT_PATH; if ( checkArgs("-m", argc, argv, NULL, drvMgr ) ) mgrSpecified = TRUE; } /* ** Set driver manager according to user input. Default is unixODBC. */ if (mgrSpecified && !STbcompare( drvMgr, 0, MGR_STR_CAI_PT, 0, TRUE ) ) driverManager = MGR_VALUE_CAI_PT; else driverManager = MGR_VALUE_UNIX_ODBC; /* ** If none of the arguments are recognized, flag an error. */ if ( !batch && !rmPkg && !isReadOnly && pathType != OCFG_ALT_PATH && !mgrSpecified && argc > 1) badCmdLine = TRUE; if ( badCmdLine ) { display_help(); PCexit(FAIL); } if ( isReadOnly ) STcopy(DRV_STR_Y, drvList[2]->value); else STcopy(DRV_STR_N, drvList[2]->value); if ( !writeMgrFile( altPath ) ) { SIprintf("Aborting due to error writing %s/files/%s\n", SYSTEM_LOCATION_SUBDIRECTORY, MGR_STR_FILE_NAME); PCexit(FAIL); } defAttr = getDefaultInfo(); if (defAttr == NULL) { SIprintf("Aborting due to error reading %s/install/%s\n", SYSTEM_LOCATION_VARIABLE, INFO_STR_FILE_NAME); PCexit(FAIL); } /* ** Get the path of the driver library and create the path/libname string. */ NMgtAt(SYSTEM_LOCATION_VARIABLE,&dirPath); /* usually II_SYSTEM */ if (dirPath != NULL && *dirPath) STlcopy(dirPath,driverPath,sizeof(driverPath)-20-1); else { SIprintf("Error--%s is not defined\n",SYSTEM_LOCATION_VARIABLE); PCexit(FAIL); } # ifdef VMS STcat(driverPath,"["); STcat(driverPath,SYSTEM_LOCATION_SUBDIRECTORY); /* usually "ingres" */ STcat(driverPath,".library]"); if ( isReadOnly ) STcat(driverPath,defAttr[INFO_ATTR_RONLY_DRV_FNAME]); else STcat(driverPath,defAttr[INFO_ATTR_DRIVER_FILE_NAME]); # else STcat(driverPath,"/"); STcat(driverPath,SYSTEM_LOCATION_SUBDIRECTORY); /* usually "ingres" */ STcat(driverPath,"/lib/"); if ( isReadOnly ) STcat(driverPath,defAttr[INFO_ATTR_RONLY_DRV_FNAME]); else STcat(driverPath,defAttr[INFO_ATTR_DRIVER_FILE_NAME]); # endif /* ifdef VMS */ STcopy(driverPath,drvList[0]->value); /* ** Initialize the cache from the odbcinst.ini file. */ openConfig(NULL, pathType, altPath, &drvH, &status); if (status != OK) { STprintf(etxt,"Could not open from path %s.\n", pathType == OCFG_ALT_PATH ? altPath : "/usr/local/etc"); display_err(etxt,status); PCexit(FAIL); } if (rmPkg) { delConfigEntry( drvH, defAttr[INFO_ATTR_DRIVER_NAME], &status ); delConfigEntry( drvH, defAttr[INFO_ATTR_ALT_DRIVER_NAME], &status ); closeConfig(drvH, &status); PCexit(OK); } /* ** Get the driver count. */ retcount = listConfig( drvH, count, list, &status ); if (status != OK) { STprintf(etxt,"Could not list drivers.\n"); display_err(etxt,status); PCexit(FAIL); } count = retcount; if (count) { /* ** Get the list of recognized drivers. */ list = (char **)MEreqmem( (u_i2) 0, (u_i4)(count * sizeof(char *)), TRUE, (STATUS *) NULL); for (i = 0; i < count; i++) list[i] = (char *)MEreqmem( (u_i2) 0, (u_i4)OCFG_MAX_STRLEN, TRUE, (STATUS *) NULL); listConfig( drvH, count, list, &status ); if (status != OK) { STprintf(etxt,"Could not list drivers.\n"); display_err(etxt,status); PCexit(FAIL); } } for (i = 0; i < count; i++) { def_or_alt = FALSE; if (!has_default) { has_default = STbcompare( list[i], 0, defAttr[INFO_ATTR_DRIVER_NAME], 0, TRUE ) == 0 ? TRUE : FALSE; if (has_default) def_or_alt = TRUE; } if (!has_alt) { has_alt = STbcompare( list[i], 0, defAttr[INFO_ATTR_ALT_DRIVER_NAME], 0, TRUE ) == 0 ? TRUE : FALSE; if (has_alt) def_or_alt = TRUE; } if (def_or_alt) { if ( !batch ) { STprintf(prompt, "\tInstallation has pre-defined version of %s.\n\tOverwrite? (Yes/No)", list[i]); if ( line_get( prompt, "", FALSE, line ) == EOF ) { SIprintf("ODBC driver installation safely aborted\n"); PCexit(OK); } STzapblank(line,line); if ( line[0] != 'y' && line [0] != 'Y' ) { SIprintf( "%s left untouched\n", list[i] ); continue; } } /* if (!batch) */ STcopy(list[i],driverName); setConfigEntry( drvH, driverName, drvCount, drvList, &status ); if (status != OK) { STprintf(etxt,"Could not write driver entry.\n"); display_err(etxt,status); PCexit(FAIL); } } /* if (has_default || has_alt) */ else if ( !batch ) { STprintf(prompt, "\tInstallation has custom version of %s.\n\tDelete? (Yes/No)", list[i]); if ( line_get( prompt, "", FALSE, line ) == EOF ) { SIprintf("ODBC driver installation safely aborted\n"); PCexit(OK); } STzapblank(line,line); if ( line[0] != 'y' && line [0] != 'Y' ) { SIprintf( "%s left untouched\n", list[i] ); continue; } STcopy(list[i],driverName); delConfigEntry( drvH, driverName, &status ); if (status != OK) { STprintf(etxt,"Could not write driver entry.\n"); display_err(etxt,status); PCexit(FAIL); } } /* if (!batch) && !has_default */ } /* for (count... */ if (!has_default) { setConfigEntry( drvH, defAttr[INFO_ATTR_DRIVER_NAME], drvCount, drvList, &status ); if (status != OK) { STprintf(etxt,"Could not write driver entry.\n"); display_err(etxt,status); PCexit(FAIL); } } if (!has_alt) { setConfigEntry( drvH, defAttr[INFO_ATTR_ALT_DRIVER_NAME], drvCount, drvList, &status ); if (status != OK) { STprintf(etxt,"Could not write driver entry.\n"); display_err(etxt,status); PCexit(FAIL); } } closeConfig(drvH, &status); if (status != OK) { STprintf(etxt,"Could not close driver info.\n"); display_err(etxt,status); PCexit(FAIL); } if (count) { for (i = 0; i < count; i++) MEfree((PTR)list[i]); MEfree((PTR)list); } for (i = 0; i < drvCount; i++) { MEfree((PTR)drvList[i]->value); MEfree((PTR)drvList[i]); } MEfree((PTR)drvList); PCexit(OK); }