Ejemplo n.º 1
0
void show_url_win(void *data, Evas_Object *obj, void *event_info)
{
	strcpy(url_pre, "http://");
	Evas_Object *notify = data;

	evas_object_hide(menu);
	elm_entry_select_all(en);
	evas_object_show(notify);
}
Ejemplo n.º 2
0
 void task_select(void *data, Evas_Object *obj, void *event_info)
{
	char tystr[2];
	char te_data[255], *task_entry;
	Elm_Object_Item *item;
	_Task *tsk=NULL;

	//for entries, get entry data and check agianst previous task text, date
	//if changed - write
	if (last_rec != -1) { //cater for initial null data
		sprintf(te_data, "%s", (const char *)elm_entry_entry_get(tk));
		task_entry = strtok(te_data, "<");
		tsk = (_Task *)elm_object_item_data_get(task_list[last_rec]);
		if (strcmp(task_entry, tsk->text) != 0) {
			sprintf(tsk->text, "%s", task_entry);
			WRITE = 1;
		}
	}
	
	if (WRITE == 1) {
		elm_genlist_item_update(task_list[last_rec]);
		update_record(tsk->no);
		WRITE = 0;
	}
	
	Evas_Object *li = data;
	item = (Elm_Object_Item *)elm_genlist_selected_item_get(li);
	tsk = (_Task *)elm_object_item_data_get(item);
	last_rec = tsk->no;
	elm_object_text_set(cat_bt, tsk->cat);
	sprintf(tystr, "%d", tsk->pr);
	elm_object_text_set(pr_bt, tystr);
	elm_object_text_set(date_bt, tsk->date);
	elm_entry_entry_set(tk, tsk->text);
	if (strcmp(tsk->text, "Task") == 0) elm_entry_select_all(tk);
}
Ejemplo n.º 3
0
EINA_DEPRECATED EAPI void
elm_scrolled_entry_select_all(Evas_Object *obj)
{return elm_entry_select_all(obj);}
Ejemplo n.º 4
0
static void
on_contact_select(void *data, Evas_Object *obj, void *event_info)
{
   Data_Contact *ctc = data;
   if (!ctc)
     {
        Evas_Object *win, *bx, *bt, *sc, *en;

        win = window;
        inwin2 = elm_win_inwin_add(win);
        elm_object_style_set(inwin2, "minimal_vertical");
        
        bx = elm_box_add(win);
        evas_object_size_hint_weight_set(bx, 1.0, 0.0);
        evas_object_size_hint_align_set(bx, -1.0, -1.0);
        
        sc = elm_scroller_add(win);
        elm_scroller_content_min_limit(sc, 0, 1);
        evas_object_size_hint_weight_set(sc, 1.0, 1.0);
        evas_object_size_hint_align_set(sc, -1.0, 0.5);
        elm_box_pack_end(bx, sc);
        
        en = elm_entry_add(win);
        elm_entry_single_line_set(en, 1);
        elm_entry_entry_set(en, "Enter number...");
        evas_object_size_hint_weight_set(en, 1.0, 0.0);
        evas_object_size_hint_align_set(en, -1.0, 0.0);
        elm_entry_select_all(en);
        elm_scroller_content_set(sc, en);
        evas_object_show(en);
        evas_object_show(sc);
        number_entry = en;
   
        bt = elm_button_add(window);
        elm_button_label_set(bt, "OK");
        evas_object_size_hint_weight_set(bt, 1.0, 0.0);
        evas_object_size_hint_align_set(bt, -1.0, -1.0);
        elm_box_pack_end(bx, bt);
        evas_object_smart_callback_add(bt, "clicked", on_number_ok, NULL);
        evas_object_show(bt);   
        
        elm_win_inwin_content_set(inwin2, bx);
        evas_object_show(bx);

        elm_win_inwin_activate(inwin2);
        elm_object_focus(en);
     }
   else if (eina_list_count(ctc->tel.numbers) > 1)
     {
        Evas_Object *win, *bx, *bx2, *bt, *li, *fr, *ph, *lb;
        Eina_List *l;
        char *name, *file;
        
        win = window;
        inwin2 = elm_win_inwin_add(win);

        bx = elm_box_add(win);
        evas_object_size_hint_weight_set(bx, 1.0, 0.0);
        evas_object_size_hint_align_set(bx, -1.0, -1.0);

        fr = elm_frame_add(win);
        name = data_contact_name_get(ctc);
        if (name)
          {
             elm_label_label_set(write_lb, name);
             elm_frame_label_set(fr, name);
             free(name);
          }
        evas_object_size_hint_weight_set(fr, 1.0, 0.0);
        evas_object_size_hint_align_set(fr, -1.0, -1.0);
        elm_box_pack_end(bx, fr);        
        evas_object_show(fr);

        bx2 = elm_box_add(win);
        elm_box_horizontal_set(bx2, 1);
        elm_frame_content_set(fr, bx2);
        evas_object_show(bx2);
        
        ph = elm_photo_add(win);
        file = data_contact_photo_file_get(ctc);
        if (file)
          {
             elm_photo_file_set(write_ph, file);
             elm_photo_file_set(ph, file);
             free(file);
          }
        evas_object_size_hint_weight_set(ph, 0.0, 0.0);
        evas_object_size_hint_align_set(ph, -1.0, -1.0);
        elm_box_pack_end(bx2, ph);
        evas_object_show(ph);
        
        lb = elm_label_add(win);
        elm_label_label_set(lb, 
                            "This contact has multiple<br>"
                            "numbers. Select one.");
        evas_object_size_hint_weight_set(lb, 1.0, 0.0);
        evas_object_size_hint_align_set(lb, -1.0, -1.0);
        elm_box_pack_end(bx2, lb);
        evas_object_show(lb);
        
        li = elm_list_add(win);
        evas_object_size_hint_weight_set(li, 1.0, 1.0);
        evas_object_size_hint_align_set(li,  -1.0, -1.0);
        elm_box_pack_end(bx, li);

        for (l = (Eina_List *)(ctc->tel.numbers); l; l = l->next)
          {
             Data_Contact_Tel *tel = l->data;
             // FIXME:
             // tel->flags can be 0 or more of:
             //    DATA_CONTACT_TEL_HOME = (1 << 0),
             //    DATA_CONTACT_TEL_MSG = (1 << 1),
             //    DATA_CONTACT_TEL_WORK = (1 << 2),
             //    DATA_CONTACT_TEL_PREF = (1 << 3),
             //    DATA_CONTACT_TEL_VOICE = (1 << 4),
             //    DATA_CONTACT_TEL_FAX = (1 << 5),
             //    DATA_CONTACT_TEL_CELL = (1 << 6),
             //    DATA_CONTACT_TEL_VIDEO = (1 << 7),
             //    DATA_CONTACT_TEL_PAGER = (1 << 8),
             //    DATA_CONTACT_TEL_BBS = (1 << 9),
             //    DATA_CONTACT_TEL_MODEM = (1 << 10),
             //    DATA_CONTACT_TEL_CAR = (1 << 11),
             //    DATA_CONTACT_TEL_ISDN = (1 << 12),
             //    DATA_CONTACT_TEL_PCS = (1 << 13)
             elm_list_item_append(li, tel->number, NULL, NULL, on_number_select, tel);
          }
        elm_list_go(li);
        
        evas_object_show(li);
        
        bt = elm_button_add(window);
        elm_button_label_set(bt, "OK");
        evas_object_size_hint_weight_set(bt, 1.0, 0.0);
        evas_object_size_hint_align_set(bt, -1.0, -1.0);
        elm_box_pack_end(bx, bt);
        evas_object_smart_callback_add(bt, "clicked", on_number_list_ok, NULL);
        evas_object_show(bt);   
        
        elm_win_inwin_content_set(inwin2, bx);
        evas_object_show(bx);

        elm_win_inwin_activate(inwin2);
        
     }
   else
     {
        Data_Contact_Tel *tel;
        char *name, *file;
        
        tel = ctc->tel.numbers->data;
        if (number) free(number);
        number = strdup(tel->number);
        elm_label_label_set(write_lb, number);
        name = data_contact_name_get(ctc);
        if (name)
          {
             elm_label_label_set(write_lb, name);
             free(name);
          }
        file = data_contact_photo_file_get(ctc);
        if (file)
          {
             elm_photo_file_set(write_ph, file);
             free(file);
          }
     }
}
Ejemplo n.º 5
0
void create_details_page(void *data, Evas_Object *obj, void *event_info)
{
	Evas_Object *bg, *tb, *lb, *bt;
	Evas_Object *det_hv, *bx, *c_date_hs, *c_date_bt, *fr1, *fr, *bt_done;
	int i;
	char no[2], dt[10];
	static Details det[15];
	time_t curtime, tm;
	struct tm *loctime;

	//get the time
	curtime = time (NULL);
	
	//check task selected - otherwise return
	Elm_Object_Item *item = (Elm_Object_Item *)elm_genlist_selected_item_get(list);
	if(!item) return;
	_Task *tsk = (_Task *)elm_object_item_data_get(item);
	det_page = elm_win_add(NULL, "inwin", ELM_WIN_BASIC);
	elm_win_title_set(det_page, "Task Details");
	elm_win_autodel_set(det_page, 1);

	bg = elm_bg_add(det_page);
	elm_win_resize_object_add(det_page, bg);
	evas_object_size_hint_weight_set(bg, 1.0, 1.0);
	evas_object_show(bg);
	
	tb = elm_table_add(det_page);
	elm_win_resize_object_add(det_page, tb);
	evas_object_size_hint_weight_set(tb, 1.0, 1.0);
	evas_object_size_hint_align_set(tb, -1.0, -1.0);
	evas_object_show(tb);
	
	//add a frame 
	fr = elm_frame_add(det_page);
	elm_object_style_set(fr, "outdent_top");
	evas_object_size_hint_align_set(fr, 0.5, -1.0);
 	elm_table_pack(tb, fr, 0, 0, 3, 1);
	evas_object_show(fr);

	//add a label to frame
	lb = elm_label_add(det_page);
	elm_object_text_set(lb,"Edit Task Details");
	evas_object_size_hint_align_set(lb, 0.5, -1.0);
	elm_object_content_set(fr, lb);
	evas_object_show(lb);

	//add a label 
	lb = elm_label_add(det_page);
	elm_object_text_set(lb,"Task:");
	evas_object_size_hint_align_set(lb, 1.0, 0.5);
 	elm_table_pack(tb, lb, 0, 1, 1, 1);
	evas_object_show(lb);

	//add an entry 
	entry = elm_entry_add(det_page);
	elm_entry_single_line_set(entry, 1);
	elm_entry_editable_set(entry, 1);
	elm_entry_entry_set(entry, tsk->text);
	elm_entry_line_wrap_set(entry, 0);
 	elm_table_pack(tb, entry, 1, 1, 2, 1);
	evas_object_show(entry);

	//add a label to hbox
	lb = elm_label_add(det_page);
	elm_object_text_set(lb,"Priority:");
	evas_object_size_hint_align_set(lb, 1.0, 0.5);
 	elm_table_pack(tb, lb, 0, 2, 1, 1);
	evas_object_show(lb);

	//add hover for priority
	det_hv = elm_hover_add(det_page);
	//add box for hover
	bx = elm_box_add(det_page);
 	elm_table_pack(tb, bx, 1, 2, 2, 1);
	evas_object_show(bx);

	c_pr_bt = elm_button_add(det_page);
	sprintf(no, "%d", tsk->pr);
	elm_object_text_set(c_pr_bt, no);
	evas_object_smart_callback_add(c_pr_bt, "clicked", my_hover_bt_1, det_hv);
	elm_box_pack_end(bx, c_pr_bt);
	evas_object_show(c_pr_bt);
	elm_hover_parent_set(det_hv, det_page);
	elm_hover_target_set(det_hv, c_pr_bt);

	bt = elm_button_add(det_page);
	elm_object_text_set(bt, "Pr");
	elm_object_part_content_set(det_hv, "middle", bt);
	evas_object_show(bt);

	bx = elm_box_add(det_page);
	//add 5 buttons
	for (i=1; i<6; i++) {
		det[i].item = item;
		det[i].hover = det_hv;
		det[i].button = c_pr_bt;
		bt = elm_button_add(det_page);
		sprintf(no, "%d", i);
		elm_object_text_set(bt, no);
		elm_box_pack_end(bx, bt);
		det[i].data = strdup(no);
		evas_object_smart_callback_add(bt, "clicked", set_create_priority, &det[i]);
		evas_object_show(bt);
	}	
	evas_object_show(bx);
	elm_object_part_content_set(det_hv, "bottom", bx);

	//add a label to hbox
	lb = elm_label_add(det_page);
	elm_object_text_set(lb,"Category:");
	evas_object_size_hint_align_set(lb, 1.0, 0.5);
 	elm_table_pack(tb, lb, 0, 3, 1, 1);
	evas_object_show(lb);

	hs = elm_hover_add(det_page);
	//add box for hover
	bx = elm_box_add(det_page);
 	elm_table_pack(tb, bx, 1, 3, 2, 1);
	evas_object_show(bx);

	cat_bt = elm_button_add(det_page);
	elm_object_text_set(cat_bt, tsk->cat);
	evas_object_smart_callback_add(cat_bt, "clicked", my_hover_bt_1, hs);
	elm_box_pack_end(bx, cat_bt);
	evas_object_show(cat_bt);
	elm_hover_parent_set(hs, det_page);
	elm_hover_target_set(hs, cat_bt);

	bt = elm_button_add(det_page);
	elm_object_text_set(bt, "Category");
	elm_object_part_content_set(hs, "middle", bt);
	evas_object_show(bt);

	bx = elm_box_add(det_page);
	//add categories
	add_hs_items (det_page, bx, bt, 0);
	evas_object_show(bx);
	elm_object_part_content_set(hs, "bottom", bx); 

	//add a label to hbox
	lb = elm_label_add(det_page);
	elm_object_text_set(lb, "Date:");
	evas_object_size_hint_align_set(lb, 1.0, 0.5);
 	elm_table_pack(tb, lb, 0, 4, 1, 1);
	evas_object_show(lb);

	//add hover for date
	c_date_hs = elm_hover_add(det_page);
	//add box for hover
	bx = elm_box_add(det_page);
 	elm_table_pack(tb, bx, 1, 4, 2, 1);
	evas_object_show(bx);

	c_date_bt = elm_button_add(det_page);
	elm_object_text_set(c_date_bt, tsk->date);
	evas_object_smart_callback_add(c_date_bt, "clicked", my_hover_bt_1, c_date_hs);
	elm_box_pack_end(bx, c_date_bt);
	evas_object_show(c_date_bt);
	elm_hover_parent_set(c_date_hs, det_page);
	elm_hover_target_set(c_date_hs, c_date_bt);

	bt = elm_button_add(det_page);
	elm_object_text_set(bt, "Date");
	elm_object_part_content_set(c_date_hs, "middle", bt);
	evas_object_show(bt);

	bx = elm_box_add(det_page);
	
	//add dates
	det[6].item = item;
	det[6].hover = c_date_hs;
	det[6].button = c_date_bt;
	sprintf(dt, "No Date");
	bt = elm_button_add(det_page);
	elm_object_text_set(bt,dt);
	elm_box_pack_end(bx, bt);
	det[6].data = strdup(dt);
	evas_object_smart_callback_add(bt, "clicked", set_create_date, &det[6]);
	evas_object_show(bt);

	for(i=0; i<7; i++) {
		det[7+i].item = item;
		det[7+i].hover = c_date_hs;
		det[7+i].button = c_date_bt;
		tm = curtime + (i * 86400);
		loctime = localtime (&tm);
		strftime(dt, 7, "%d-%m", loctime);
		bt = elm_button_add(det_page);
		elm_object_text_set(bt,dt);
		elm_box_pack_end(bx, bt);
		det[7+i].data = strdup(dt);
		evas_object_smart_callback_add(bt, "clicked", set_create_date, &det[7+i]);
		evas_object_show(bt);
	}

	det[14].item = item;
	det[14].hover = c_date_hs;
	det[14].button = c_date_bt;
	sprintf(dt, "Calendar");
	bt = elm_button_add(det_page);
	elm_object_text_set(bt,dt);
	elm_box_pack_end(bx, bt);
	det[14].data = strdup(dt);
	evas_object_smart_callback_add(bt, "clicked", set_create_date, &det[14]);
	evas_object_show(bt);
	
	evas_object_show(bx);
	elm_object_part_content_set(c_date_hs, "bottom", bx);

	//add a label 
	lb = elm_label_add(det_page);
	elm_object_text_set(lb,"Note:");
	evas_object_size_hint_align_set(lb, 1.0, 0.5);
 	elm_table_pack(tb, lb, 0, 5, 1, 1);
	evas_object_show(lb);

	//add an entry 
	note_entry = elm_entry_add(det_page);
	elm_entry_single_line_set(note_entry, 1);
	elm_entry_editable_set(note_entry, 1);
	if(strcmp(tsk->note, "") != 0) elm_entry_entry_set(note_entry, tsk->note);
	else {
		elm_entry_entry_set(note_entry, "Note"); 
		   elm_entry_select_all(note_entry);
	}
	elm_entry_line_wrap_set(note_entry, 0);
 	elm_table_pack(tb, note_entry, 1, 5, 2, 1);
	evas_object_show(note_entry);

	/*lb = elm_label_add(det_page);
	elm_object_text_set(lb,"Note:");
 	elm_table_pack(tb, lb, 1, 5, 2, 1);
	evas_object_show(lb);*/
	
	//add a frame 
	fr1 = elm_frame_add(det_page);
	elm_object_style_set(fr1, "outdent_bottom");
	evas_object_size_hint_weight_set(fr1, -1.0, 0.0);
	evas_object_size_hint_align_set(fr1, -1.0, -1.0);
 	elm_table_pack(tb, fr1, 0, 6, 3, 1);
	evas_object_show(fr1);
	
	//add done button
	bt_done = elm_button_add(det_page);
	elm_object_text_set(bt_done, "Done");
	evas_object_size_hint_weight_set(bt_done, 1.0, 0.0);
	evas_object_size_hint_align_set(bt_done, -1.0, -1.0);
 	elm_table_pack(tb, bt_done, 0, 7, 1, 1);
	evas_object_show(bt_done);
	evas_object_smart_callback_add(bt_done, "clicked", det_page_done, (_Task *)tsk);
	
	//add del button
	bt = elm_button_add(det_page);
	elm_object_text_set(bt, "Delete");
	evas_object_size_hint_weight_set(bt, 1.0, 0.0);
	evas_object_size_hint_align_set(bt, -1.0, -1.0);
 	elm_table_pack(tb, bt, 1, 7, 1, 1);
	evas_object_show(bt);
	evas_object_smart_callback_add(bt, "clicked", det_page_del, (_Task *)tsk);

	//add yes button
	//bt = elm_button_add(det_page);
	//evas_object_size_hint_weight_set(bt, 1.0, 1.0);
	//evas_object_size_hint_align_set(bt, -1.0, -1.0);
	//elm_object_text_set(bt, "Note");
	//elm_box_pack_end(hbox1, bt);
	//evas_object_show(bt);
	//evas_object_smart_callback_add(bt, "clicked", det_page_add, entry);
	
	//add close button
	bt = elm_button_add(det_page);
	evas_object_size_hint_weight_set(bt, 1.0, 0.0);
	evas_object_size_hint_align_set(bt, -1.0, -1.0);
	elm_object_text_set(bt, "Cancel");
 	elm_table_pack(tb, bt, 2, 7, 1, 1);
	evas_object_show(bt);
	evas_object_smart_callback_add(bt, "clicked", cat_win_del, det_page);
	
	evas_object_resize(det_page, 480, 640);
	evas_object_show(det_page);
}