void win_char_editor::closeEvent(QCloseEvent *e) { if (ask_if_save()) e->accept(); else e->ignore(); }
void win_char_editor::file_open() { if (!ask_if_save()) return; QString new_file = open_chr(this); if (!new_file.isEmpty()) if (w_main->char_open(new_file, &(c->cs), TRUE)) { file = new_file; never_saved = FALSE; setWindowModified(FALSE); setWindowTitle(QFileInfo(file).completeBaseName() + "[*] - Char Editor"); char_width->setCurrentIndex(c->cs.width - 1); c->ur.clear(); c->setUpdatesEnabled(FALSE); c->setUpdatesEnabled(TRUE); } }
boolean fips_partition::split (fips_harddrive hd) { if (read_boot_sector ()) error ("Error reading boot sector"); if (global.debug_mode) { fprintf ( global.debugfile, "\nBoot sector drive %02Xh, partition %u:\n\n", hd.number, number + 1 ); hexwrite ( boot_sector->data, 512, global.debugfile ); } get_bpb (); printx ("\nBoot sector:\n\n"); print_bpb (); get_info (); if (global.debug_mode) write_info_debugfile (); check (); fat16 fat1 (this,1); fat16 fat2 (this,2); fat1.check_against (&fat2); dword new_part_min_cylinder = min_cylinder (fat2, hd.geometry); if (ask_if_save()) save_root_and_boot(&hd,this); dword new_start_cylinder = ask_for_new_start_cylinder ( partition_info->start_cylinder, new_part_min_cylinder, partition_info->end_cylinder, hd.geometry.heads * hd.geometry.sectors ); fat2.check_empty ( new_start_cylinder * hd.geometry.heads * hd.geometry.sectors - partition_info->start_sector_abs ); hd.calculate_new_root (new_start_cylinder, this); hd.put_partition_table(); hd.get_partition_table(); printx ("\nNew partition table:\n\n"); hd.print_partition_table (); hd.check (FINAL_CHECK); if (ask_if_continue () == false) { return (false); } calculate_new_boot (); put_bpb (); get_bpb (); printx ("\nNew boot sector:\n\n"); print_bpb (); get_info (); if (global.debug_mode) write_info_debugfile (); check(); if (!global.test_mode) { ask_for_write_permission (); if (hd.write_root_sector ()) error ("Error writing root sector"); if (write_boot_sector ()) error ("Error writing boot sector"); printx ("Repartitioning complete\n"); } return (true); }