int save_all_map(void) { int x,y,z; char info[160]; char *txt; if ((z=check_map(&x,&y))!=0) { WINDOW *w; unselect_map(); if ((w=find_window(tool_bar))!=NULL) close_window(w); tool_sel=30; create_map_win(-1); open_sector_win(); jdi_na_sektor(x); } sprintf(info,"Chyba %02d na pozici %d:%d",-z,x,y); switch (z) { case -1:msg_box(info,'\01',"Chyb� definice st�ny!","OK",NULL);break; case -2:msg_box(info,'\01',"Chodba vede do neexistuj�c�ho sektoru!","OK",NULL);break; case -3:msg_box(info,'\01',"Schody jsou �patn� spojen� se sousedn�m� sektory!","OK",NULL);break; case -4:msg_box(info,'\01',"Ud�lost v neexistuj�c�m sektoru!","OK",NULL);break; } if (!backup) { create_backup(filename); create_backup(SHOP_NAME); create_backup(ITEMS_DAT); create_backup(MOB_FILE); create_backup(MOB_SOUND); backup=1; } if (save_map(filename)) { sprintf(info,"Nedok��u ulo�it soubor %s.",filename); msg_box("Chyba I/O",'\01',info,"!Panika!",NULL); } else txt=pripona(filename,TXT); save_items(); if (_access(txt,0)!=0) { FILE *f; f=fopen(txt,"w"); if (f) { fputs("-1\n",f); fclose(f); } } if (!mglob.local_monsters) { save_mobs(); save_sound_map(); } save_all_shops(); validate_sound_map(); return z; }
static void edit_vyklenek_start() { int smer,sector; int id; smer=f_get_value(0,370); sector=f_get_value(0,360); id=find_vyklenek_id(sector,smer); if (id==-1) { TVYKLENEK *v; id=find_free_vyklenek(); if (id==-1) { msg_box("Omezeni!",'\x1',"V mapˆ je pou‘ito ji‘ mnoho v˜klenk– ve zdi. Maxim ln¡ po‡et je 256","Ok",NULL); return; } v=vyklenky+id; v->xpos=250; v->ypos=160; v->xs=80; v->ys=60; v->sector=sector; v->dir=smer; v->items[0]=0; } edit_vyklenek(id); refresh_vyk_map(); }
/* * Advance the skill point of the skill specified by i and * modify related skills */ void increase_skill(int i, s16b *invest) { s32b max_skill_overage; /* No skill points to be allocated */ if (!p_ptr->skill_points) return; /* The skill cannot be increased */ if (!s_info[i].mod) return; /* The skill is already maxed */ if (s_info[i].value >= SKILL_MAX) return; /* Cannot allocate more than player level + max_skill_overage levels */ call_lua("get_module_info", "(s)", "d", "max_skill_overage", &max_skill_overage); if (((s_info[i].value + s_info[i].mod) / SKILL_STEP) >= (p_ptr->lev + max_skill_overage + 1)) { int hgt, wid; Term_get_size(&wid, &hgt); msg_box(format("Cannot raise a skill value above %i + player level.", max_skill_overage), (int)(hgt / 2), (int)(wid / 2)); return; } /* Spend an unallocated skill point */ p_ptr->skill_points--; /* Increase the skill */ s_info[i].value += s_info[i].mod; invest[i]++; }
/* This function can take 2 parameters: - an error to translate or 0 - a pure message or NULL */ int tiemu_error(int err_code, char *err_str) { int err = err_code; char s[512]; if(!err_code && !err_str) return 0; if(err_code) { /* Retrieve the error message */ err = ticable_get_error(err, s); if (err) { err = tifiles_get_error(err, s); if (err) { err = ticalc_get_error(err, s); if (err) { // next level: error for TiEmu } } } } else if(err_str) { strcpy(s, err_str); } printl(2, "%s", s); msg_box(_("Error"), s); return err_code; }
void on_flashfile_ok_button2_clicked (GtkButton *button, gpointer user_data) { GtkWidget *w; gchar *filename; gchar buffer[1024]; gchar *ext = NULL; filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(user_data)); ext = strrchr(filename, '.'); if(str_cmp(ext, ".tib") && str_cmp(ext, ".89u") && str_cmp(ext, ".9xu")) { msg_box(_("Error"), _("Invalid file")); gtk_widget_destroy(GTK_WIDGET(user_data)); gtk_widget_show(create_step1_dbox()); return; } gtk_widget_show((w = create_wait_dbox())); while( gtk_events_pending() ) { gtk_main_iteration(); } ti68k_convertTibToRom(filename, buffer); wizard_rom = g_strdup(buffer); gtk_widget_destroy(w); while( gtk_events_pending() ) { gtk_main_iteration(); } gtk_widget_destroy(GTK_WIDGET(user_data)); gtk_widget_show(create_step3_dbox()); }
/* TODO: Store cookie in data arg. --jonas*/ void accept_cookie_dialog(struct session *ses, void *data) { /* [gettext_accelerator_context(accept_cookie_dialog)] */ struct cookie *cookie = (struct cookie *)cookie_queries.next; struct string string; assert(ses); if (list_empty(cookie_queries) || !init_string(&string)) return; del_from_list(cookie); add_format_to_string(&string, (const char *)_("Do you want to accept a cookie from %s?", ses->tab->term), cookie->server->host); add_to_string(&string, (const unsigned char *)"\n\n"); add_cookie_info_to_string(&string, cookie, ses->tab->term); msg_box(ses->tab->term, NULL, MSGBOX_FREE_TEXT, N_("Accept cookie?"), ALIGN_LEFT, string.source, cookie, 2, MSG_BOX_BUTTON(N_("~Accept"), accept_cookie_in_msg_box, B_ENTER), MSG_BOX_BUTTON(N_("~Reject"), reject_cookie_in_msg_box, B_ESC)); }
void tn_func(struct session *ses, unsigned char *url, struct list_head *prog, unsigned char *t1, unsigned char *t2) { unsigned char *m; unsigned char *h, *p; int hl, pl; unsigned char *hh, *pp; int f = 1; if (parse_url(url, NULL, NULL, NULL, NULL, NULL, &h, &hl, &p, &pl, NULL, NULL, NULL) || !hl) goto fail; if (!(hh = memacpy(h, hl))) goto fail; if (pl && !(pp = memacpy(p, pl))) goto fail1; check_shell_security(&hh); if (pl) check_shell_security(&pp); m = mem_alloc(strlen(hh) + (pl ? strlen(pp) : 0) + 2); f = 0; strcpy(m, hh); if (pl) { strcat(m, " "); strcat(m, pp); m[hl + 1 + pl] = 0; } prog_func(ses->term, prog, m, t1); mem_free(m); if (pl) mem_free(pp); fail1: mem_free(hh); fail: if (f) msg_box(ses->term, NULL, TEXT(T_BAD_URL_SYNTAX), AL_CENTER, t2, NULL, 1, TEXT(T_CANCEL), NULL, B_ENTER | B_ESC); }
void mms_func(struct session *ses, unsigned char *url) { if (check_shell_url(url)) { msg_box(ses->term, NULL, TEXT(T_BAD_URL_SYNTAX), AL_CENTER, TEXT(T_MMS_URL_CONTAINS_INACCEPTABLE_CHARACTERS), NULL, 1, TEXT(T_CANCEL), NULL, B_ENTER | B_ESC); return; } prog_func(ses->term, &mms_prog, url, TEXT(T_MMS)); }
void on_keyboard_download_button_clicked (GtkButton *button, gpointer user_data) { msg_box ( _("After you downloaded the right file for your keyboard, " "click on the 'Import...' button and select the file you " "downloaded."), GTK_MESSAGE_INFO ); run_browser (preferences.browser, URL_DOWNLOAD_KEYBOARDS); }
void on_plugin_download_button_clicked (GtkButton *button, gpointer user_data) { msg_box ( _("After you downloaded a plugin for the keyTouch site, " "click on the 'Import...' button and select the plugin " "you downloaded."), GTK_MESSAGE_INFO ); run_browser (preferences.browser, URL_DOWNLOAD_PLUGINS); }
// returns the work of the token after token char *get_next_word(Ttoken *t) { Ttoken *next = (Ttoken *)t->next; if (next == NULL) { char buf[80]; sprintf(buf, "<%s> has no next", t->word); msg_box(buf); } return next->word; }
/* * Advance the skill point of the skill specified by i and * modify related skills */ void increase_skill(s32b i, s16b *invest) { s32b max_skill_overage, max_level; cptr error = NULL; /* No skill points to be allocated */ if (!p_ptr->skill_points) return; /* The skill cannot be increased */ if (!s_info[i].mod) return; /* The skill is already maxed */ call_lua("get_module_info", "(s)", "d", "max_skill_level", &max_level); if (s_info[i].value >= max_level * SKILL_STEP) return; /* Cannot allocate more than player level + max_skill_overage levels */ call_lua("get_module_info", "(s)", "d", "max_skill_overage", &max_skill_overage); if (((s_info[i].value + s_info[i].mod) / SKILL_STEP) >= (p_ptr->lev + max_skill_overage + 1)) { s32b hgt, wid; Term_get_size(&wid, &hgt); msg_box(format("Cannot raise a skill value to or above %d until you get more experienced.", p_ptr->lev + max_skill_overage), (s32b)(hgt / 2), (s32b)(wid / 2)); return; } /* More complex checking */ call_lua("get_module_info", "(s,d)", "s", "allow_skill_raise", i, &error); if (error) { s32b hgt, wid; Term_get_size(&wid, &hgt); msg_box(error, (s32b)(hgt / 2), (s32b)(wid / 2)); return; } /* Spend an unallocated skill point */ p_ptr->skill_points--; /* Increase the skill */ s_info[i].value += s_info[i].mod; invest[i]++; }
void FormMain::onGenerationDone(TemplateCore::GenerationResult result_code, const QString &output_file) { qApp->processEvents(); m_generatedApplicationPath = output_file; if (qApp->templateManager()->activeCore() != NULL) { m_ui->m_actionGenerateMobileApplication->setEnabled(qApp->templateManager()->activeCore()->editor()->canGenerateApplications()); } else { m_ui->m_actionGenerateMobileApplication->setEnabled(false); } m_statusLabel->clear(); m_statusLabel->setVisible(false); m_statusProgress->setValue(0); m_statusProgress->setVisible(false); // TODO: Print information about result. switch (result_code) { case TemplateCore::Success: { CustomMessageBox msg_box(this); // Initialize message box properties. msg_box.setWindowTitle(tr("Mobile application generated")); #if defined(Q_OS_WIN32) msg_box.setText(tr("Mobile application was successfully generated.")); QPushButton *btn_open_folder = msg_box.addButton(tr("Open output folder"), QMessageBox::DestructiveRole); connect(btn_open_folder, SIGNAL(clicked()), this, SLOT(openOutputDirectory())); #else msg_box.setText(tr("Mobile application was successfully generated and is placed in " "output directory \"%1\"").arg(QDir::toNativeSeparators(qApp->templateManager()->outputDirectory()))); #endif msg_box.setIcon(QMessageBox::Information); msg_box.setStandardButtons(QMessageBox::Ok); // Setup button box icons. #if defined(Q_OS_OS2) QDialogButtonBox *button_box = msg_box.findChild<QDialogButtonBox*>(); CustomMessageBox::iconify(button_box); #endif msg_box.exec(); break; } case TemplateCore::Aborted: // Supress abortion state because this is not critical state. break; default: CustomMessageBox::show(this, QMessageBox::Critical, tr("Mobile application not generated"), tr("Application was NOT generated successfully.")); break; } }
GLADE_CB void on_transient1_activate (GtkMenuItem *menu_item, gpointer user_data) { // This make dbg wnd's as children of the main window. // Thus, the taskbar is not filled-up with a lot of windows. options3.transient = GTK_CHECK_MENU_ITEM(menu_item)->active; msg_box("Warning", "You will have to save configuration and restart TiEmu for changes to take effect !"); }
void on_change_button_clicked (GtkButton *button, gpointer user_data) { msg_box (_("To change the keyboard keyTouch has to be closed. " "After you changed the keyboard keyTouch will be started again."), GTK_MESSAGE_INFO); system ("keytouch-keyboard --restart-keytouch &"); gtk_main_quit(); exit (0); }
void show_RichText_Generic_MsgBox (QMessageBox::Icon icon, const QString &main_text, const QString &informative_text) { QString fixup_main_text (convert_to_rich_text (main_text)); QString fixup_informative_text (convert_to_rich_text (informative_text, true)); QMessageBox msg_box (icon, QString ("X2Go Client"), fixup_main_text, QMessageBox::Ok); msg_box.setTextFormat (Qt::RichText); msg_box.setInformativeText (fixup_informative_text); msg_box.setWindowModality (Qt::WindowModal); msg_box.exec (); }
gint display_set_tib_dbox(void) { const gchar *filename; gchar *path, *name; int err; // get filename filename = create_fsel(inst_paths.base_dir, NULL, "*.89u;*.9xu;*.v2u;*.tib", FALSE); if (!filename) return 0; if(!ti68k_is_a_tib_file(filename)) { msg_box("Error", "Don't seem to be an upgrade."); return -1; } path = g_path_get_dirname(filename); name = g_path_get_basename(filename); // set tib file g_free(params.tib_file); params.tib_file = g_strconcat(path, G_DIR_SEPARATOR_S, name, NULL); g_free(path); g_free(name); err = ti68k_load_upgrade(params.tib_file); handle_error(); if(err) { msg_box("Error", "Can not load the upgrade."); return -1; } //msg_box(_("Information"), _("Your configuration has been saved.")); //rcfile_write(); // simply reset, don't restart ti68k_reset(); return 0; }
gint display_save_state_dbox() { const gchar *filename; int err; gchar *basename; gchar *dot; gchar *pattern; // get filename basename = g_path_get_basename(params.rom_file); dot = strrchr(basename, '.'); if(dot != NULL) *dot = '\0'; pattern = g_strconcat(basename, ".sav", NULL); g_free(basename); filename = create_fsel(inst_paths.home_dir, pattern, "*.sav", TRUE); g_free(pattern); if (!filename) return 0; g_free(params.sav_file); params.sav_file = g_strdup(filename); err = ti68k_state_save(params.sav_file); handle_error(); if(!rcfile_exist()) { rcfile_write(); #ifdef __WIN32__ msg_box(_("Information"), _("You do not seem to have saved your settings. Configuration file saved (in tiemu.ini).")); #else msg_box(_("Information"), _("You do not seem to have saved your settings. Configuration file saved (in ~/.tiemu).")); #endif } return 0; }
void prog_func(struct terminal *term, struct list_head *list, unsigned char *param, unsigned char *name) { unsigned char *prog, *cmd; if (!(prog = get_prog(list)) || !*prog) { msg_box(term, NULL, TEXT(T_NO_PROGRAM), AL_CENTER | AL_EXTD_TEXT, TEXT(T_NO_PROGRAM_SPECIFIED_FOR), " ", name, ".", NULL, NULL, 1, TEXT(T_CANCEL), NULL, B_ENTER | B_ESC); return; } if ((cmd = subst_file(prog, param, 0))) { exec_on_terminal(term, cmd, "", 1); mem_free(cmd); } }
void close_app(void) { WINDOW *w; CTL3D x = {0,0,0,0}; w = create_window(0,0,1,1,0,&x); desktop_add_window(w); define(-1,0,0,639,477,0,fog_bar);property(NULL,NULL,NULL,RGB555(16,0,0)); redraw_desktop(); if ((ask_exit_status = msg_box("Dotaz?",'\x2',"Chce¨ program ukon‡it, nebo nahr t jinou mapu?","Jinou mapu","Ukon‡it","Ne",NULL)) != 3) terminate(); close_window(w); do_events(); }
void MyMainWindow::on_add_file_clicked() { QList<QString> file_list = QFileDialog::getOpenFileNames(this, "Open File(s)", QString(), QString(), nullptr, QFileDialog::DontResolveSymlinks); QList<QString> red_list = QList<QString>(); bool added = false; for(QList<QString>::iterator it = file_list.begin(); it != file_list.end(); ++it) { int row_num = file_model->rowCount(); // check to see if the file is already in the model if(file_model->isRedundant(*it)) { // create a list of all these files that were redundant red_list.append(*it); } else { file_model->insertItem(row_num, *it); added = true; } } // resize the columns if a file was added if(added) setModel(file_model); if(red_list.size() > 0) { // create message QString warn_title = "File(s) already added!"; QString warn_text = "The following file(s) were already added. They will not be added again."; QString warn_detail; for(int i = 0; i < red_list.size(); i++) { warn_detail += red_list[i]; if(i != red_list.size() - 1) warn_detail += '\n'; } // display in message box QMessageBox msg_box(QMessageBox::Warning, warn_title, warn_text, QMessageBox::Close, this); msg_box.setDetailedText(warn_detail); msg_box.exec(); } }
void menu_sumber(unsigned int ttk) { int i; int jum_aktif=0; //teks_arial(menu_kanan+menu_kiri+4, menu_besar_tinggi-18, "Sumber Data"); // tampilkan yang aktif saja ! for (i=0; i<JML_SUMBER; i++) { #ifdef BOARD_TAMPILAN if (sumber[i].status == 1 || sumber[i].status == 5) { sprintf(tek, "%2d %s", (i+1), sumber[i].nama); teks_layar(72, 27 + (jum_aktif*9), tek); // print out IP sprintf(tek,"%d.%d.%d.%d", sumber[i].IP0, sumber[i].IP1, sumber[i].IP2, sumber[i].IP3); teks_layar(170, 27 + (jum_aktif*9), tek); /* // status if (sumber[i].status == 0) teks_layar(270, 30 + (i*9), "Null"); if (sumber[i].status == 1) teks_layar(270, 30 + (i*9), "Normal"); if (sumber[i].status == 2) teks_layar(270, 30 + (i*9), "TimeOut"); */ // jumlah reply sprintf(tek, "%d", status[i].reply); teks_layar(270, 27 + (jum_aktif*9), tek); /* nomer sumber yang aktif disimpan */ isi_sumber[jum_aktif] = i; jum_aktif++; } #endif } if (jum_aktif == 0) { msg_box("Tidak ada sumber data aktif !"); } teks_layar(68, 216, "Tekan OK untuk melihat raw data"); }
char check_data_password(void) { char text[50]; if (data_password[0] == 0) data_edit_enabled = 1; if (data_edit_enabled) return 1; if (ask_password(text,0) == 0) return 0; if (strcmp(data_password,text)) { msg_box("Chyba!",1,"Chybn‚ heslo! P©¡stup zam¡tnut!","OK",NULL); return 0; } else { data_edit_enabled = 1; return 1; } }
void mailto_func(struct session *ses, unsigned char *url) { unsigned char *user, *host, *m; int f = 1; if (!(user = get_user_name(url))) goto fail; if (!(host = get_host_name(url))) goto fail1; m = mem_alloc(strlen(user) + strlen(host) + 2); f = 0; strcpy(m, user); strcat(m, "@"); strcat(m, host); check_shell_security(&m); prog_func(ses->term, &mailto_prog, m, TEXT(T_MAIL)); mem_free(m); mem_free(host); fail1: mem_free(user); fail: if (f) msg_box(ses->term, NULL, TEXT(T_BAD_URL_SYNTAX), AL_CENTER, TEXT(T_BAD_MAILTO_URL), NULL, 1, TEXT(T_CANCEL), NULL, B_ENTER | B_ESC); }
void prg_error(EVENT_MSG *msg,void **unused) { int *err; char *c; unused; if (msg->msg == E_PRGERROR) { err = (int *)(*(int **)msg->data); switch (*err) { case ERR_MEMREF:c = error_texts[1];break; case ERR_ILLEGI:c = error_texts[2];break; default: c = error_texts[3];break; } zobraz_mysku(); showview(0,0,0,0); *err = 2-msg_box(error_texts[0],' ',c,"Ignoruj","Konec","Ulo‘ mapu",NULL); if (*err == -1) save_all_map(); } }
void on_romfile_ok_button2_clicked (GtkButton *button, gpointer user_data) { gchar *filename; gchar *ext = NULL; filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(user_data)); ext = strrchr(filename, '.'); if(str_cmp(ext, ".rom")) { msg_box(_("Error"), _("Invalid file")); gtk_widget_destroy(GTK_WIDGET(user_data)); gtk_widget_show(create_step1_dbox()); return; } wizard_rom = g_strdup(filename); gtk_widget_destroy(GTK_WIDGET(user_data)); gtk_widget_show(create_step3_dbox()); }
/* Learn an ability */ static void gain_ability(s32b ab) { s32b wid, hgt; Term_get_size(&wid, &hgt); if (!can_learn_ability(ab)) { msg_box("You cannot learn this ability.", (s32b)(hgt / 2), (s32b)(wid / 2)); return; } /* Flush input as we ask an important and irreversible question */ flush(); /* Ask we can commit the change */ /* if (msg_box("Learn this ability(this is permanent)? (y/n)", (s32b)(hgt / 2), (s32b)(wid / 2)) != 'y') { return; }*/ ab_info[ab].acquired = TRUE; p_ptr->skill_points -= ab_info[ab].cost; }
// runs a script // returns -1 is esc was pressed, 0 o/w int run_script(char *script, DATAFILE *d) { char buf[512]; Ttoken *token; int i; // set datafile data = d; clear_keybuf(); // init sound memory for(i = 0; i < MAX_SCRIPT_SOUNDS; i ++) active_sounds[i] = -1; // create gfx buffers swap_buffer = create_bitmap(160, 120); buffer = create_bitmap(160, 120); script_done = FALSE; while(!script_done) { // get commands from script string script = get_line(buf, script); if (buf[0] != '#' && buf[0] != '\n' && buf[0] != '\r' && buf[0] != '-') { token = tokenize(buf); if (token != NULL) { if (!stricmp(token->word, "load_map")) cmd_loadmap(get_next_word(token)); else if (!stricmp(token->word, "draw_map")) cmd_drawmap(); else if (!stricmp(token->word, "set")) cmd_set((Ttoken *)token->next); else if (!stricmp(token->word, "move")) cmd_move((Ttoken *)token->next); else if (!stricmp(token->word, "delete")) cmd_del((Ttoken *)token->next); else if (!stricmp(token->word, "run")) cmd_run((Ttoken *)token->next); else if (!stricmp(token->word, "speak")) cmd_speak((Ttoken *)token->next, 1); else if (!stricmp(token->word, "text")) cmd_speak((Ttoken *)token->next, 0); else if (!stricmp(token->word, "save_buffer")) cmd_savebmp(); else if (!stricmp(token->word, "show_bmp")) cmd_showbmp(get_next_word(token)); else if (!stricmp(token->word, "blit")) cmd_blit(); else if (!stricmp(token->word, "fade_in")) cmd_fadein(); else if (!stricmp(token->word, "fade_out")) cmd_fadeout(); else if (!stricmp(token->word, "wait")) cmd_wait(atoi(get_next_word(token))); else if (!stricmp(token->word, "play_sample")) cmd_play_sample((Ttoken *)token->next); else if (!stricmp(token->word, "stop_sample")) cmd_stop_sample((Ttoken *)token->next); else if (!stricmp(token->word, "end_script")) cmd_end(); else { char msg[256]; sprintf(msg, "unknown: %s", token->word); msg_box(msg); } flush_tokens(token); } } } // destroy buffers delete_all_objects(); destroy_bitmap(buffer); destroy_bitmap(swap_buffer); // stop old sounds for(i = 0; i < MAX_SCRIPT_SOUNDS; i ++) { if (active_sounds[i] != -1) { stop_sound_id(active_sounds[i]); forget_sound(active_sounds[i]); } } return (script_done == -1 ? -1 : 0); }
void ses_goto(struct session *ses, struct uri *uri, unsigned char *target_frame, struct location *target_location, enum cache_mode cache_mode, enum task_type task_type, int redir) { /* [gettext_accelerator_context(ses_goto)] */ struct task *task; int referrer_incomplete = 0; int malicious_uri = 0; int confirm_submit = uri->form && get_opt_bool("document.browse.forms" ".confirm_submit", ses); unsigned char *m1 = NULL, *message = NULL; struct memory_list *mlist = NULL; if (ses->doc_view && ses->doc_view->document && ses->doc_view->document->refresh) { kill_document_refresh(ses->doc_view->document->refresh); } assertm(!ses->loading_uri, "Buggy URI reference counting"); /* Reset the redirect counter if this is not a redirect. */ if (!redir) { ses->redirect_cnt = 0; } /* Figure out whether to confirm submit or not */ /* Only confirm submit if we are posting form data or a misleading URI * was detected. */ /* Note uri->post might be empty here but we are still supposely * posting form data so this should be more correct. */ if (uri->user && uri->userlen && get_opt_bool("document.browse.links.warn_malicious", ses) && check_malicious_uri(uri)) { malicious_uri = 1; confirm_submit = 1; } else if (uri->form) { /* First check if the referring URI was incomplete. It * indicates that the posted form data might be incomplete too. * See bug 460. */ if (ses->referrer) { struct cache_entry *cached; cached = find_in_cache(ses->referrer); referrer_incomplete = (cached && cached->incomplete); } if (referrer_incomplete) { confirm_submit = 1; } else if (get_validated_cache_entry(uri, cache_mode)) { confirm_submit = 0; } } if (!confirm_submit) { ses_load(ses, get_uri_reference(uri), target_frame, target_location, cache_mode, task_type); return; } task = mem_alloc(sizeof(*task)); if (!task) return; task->ses = ses; task->uri = get_uri_reference(uri); task->cache_mode = cache_mode; task->session_task.type = task_type; task->session_task.target.frame = null_or_stracpy(target_frame); task->session_task.target.location = target_location; if (malicious_uri) { unsigned char *host = memacpy(uri->host, uri->hostlen); unsigned char *user = memacpy(uri->user, uri->userlen); unsigned char *uristring = get_uri_string(uri, URI_PUBLIC); message = msg_text(ses->tab->term, N_("The URL you are about to follow might be maliciously " "crafted in order to confuse you. By following the URL " "you will be connecting to host \"%s\" as user \"%s\".\n\n" "Do you want to go to URL %s?"), host, user, uristring); mem_free_if(host); mem_free_if(user); mem_free_if(uristring); } else if (redir) { m1 = N_("Do you want to follow the redirect and post form data " "to URL %s?"); } else if (referrer_incomplete) { m1 = N_("The form data you are about to post might be incomplete.\n" "Do you want to post to URL %s?"); } else if (task_type == TASK_FORWARD) { m1 = N_("Do you want to post form data to URL %s?"); } else { m1 = N_("Do you want to repost form data to URL %s?"); } if (!message && m1) { unsigned char *uristring = get_uri_string(uri, URI_PUBLIC); message = msg_text(ses->tab->term, m1, uristring); mem_free_if(uristring); } add_to_ml(&mlist, task, (void *) NULL); if (task->session_task.target.frame) add_to_ml(&mlist, task->session_task.target.frame, (void *) NULL); msg_box(ses->tab->term, mlist, MSGBOX_FREE_TEXT, N_("Warning"), ALIGN_CENTER, message, task, 2, MSG_BOX_BUTTON(N_("~Yes"), post_yes, B_ENTER), MSG_BOX_BUTTON(N_("~No"), post_no, B_ESC)); }
void MyMainWindow::on_add_directory_clicked() { QString dir = QFileDialog::getExistingDirectory(this, "Open Directory", QString(), QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); if(dir != QString()) { QString warn_title; QString warn_text; QString warn_detail; // don't let the user add in a root directory if(QDir(QDir(dir).absolutePath()).isRoot()) { warn_title = "Can't add a root directory!"; warn_text = "The root directory (" + dir + ") cannot be added."; QMessageBox msg_box(QMessageBox::Warning, warn_title, warn_text, QMessageBox::Close, this); msg_box.exec(); } // is the directory contained by anything already inside the model or a duplicate? else if(file_model->isRedundant(dir)) { // create message warn_title = "Directory already added!"; warn_text = "The following directory was already added. It will not be added again."; warn_detail = dir; // display in message box QMessageBox msg_box(QMessageBox::Warning, warn_title, warn_text, QMessageBox::Close, this); msg_box.setDetailedText(warn_detail); msg_box.exec(); } else { std::vector<QString> red_list = file_model->makesRedundant(dir); // check if the directory chosen makes something redundant inside the model if(red_list.size() > 0) { // ask if they want to add the directory. if so, the redundant items will be removed warn_title = "Directory makes item(s) redundant!"; warn_text = "The directory chosen (" + dir + ") contains item(s) inside it that " "were added previously. If you add this new directory, the following redundant items will " "be removed."; for(int i = 0; i < red_list.size(); i++) { warn_detail += red_list[i]; if(i != red_list.size() - 1) warn_detail += '\n'; } // display the message with Ok and Cancel buttons QMessageBox msg_box(QMessageBox::Warning, warn_title, warn_text, QMessageBox::Ok | QMessageBox::Cancel, this); msg_box.setDetailedText(warn_detail); if(msg_box.exec() == QMessageBox::Ok) { file_model->removeItems(red_list); file_model->insertItem(0, dir); file_model->startDirThread(0); // resize the columns setModel(file_model); } } // the chosen directory doesn't make anything inside the model redundant, simply add it else { file_model->insertItem(0, dir); file_model->startDirThread(0); setModel(file_model); } } } // if(dir != QString()) }