示例#1
0
static BOOL twitter_button_handler( void )
{
   const char *username = ssd_dialog_get_value( "TwitterUserName" );
   const char *password = ssd_dialog_get_value( "TwitterPassword" );
   const char *tweet_signup = ssd_dialog_get_data( WELCOME_WIZ_DLG_TWITTER_SET_SIGNUP );
   BOOL is_tweet_signup = !strcmp( tweet_signup, "yes" );
   BOOL res = FALSE;

   if (!username || !*username){
      roadmap_messagebox("Error", "Please enter a user name");
      return FALSE;
   }

   if (!password || !*password){
      roadmap_messagebox("Error", "Please enter password");
      return FALSE;
   }

   roadmap_twitter_set_username( username );
   roadmap_twitter_set_password( password );
   roadmap_twitter_set_signup( is_tweet_signup );

   roadmap_config_save(TRUE);
   res = Realtime_TwitterConnect( username, password, roadmap_twitter_is_signup_enabled() );

   if ( res )
   {
      roadmap_twitter_set_signup( FALSE );
   }
   return TRUE;
}
示例#2
0
static int on_login_ok() {
   BOOL logged_in;

   const char * user_name = ssd_dialog_get_value("FoursquareUserName");
   const char * password = ssd_dialog_get_value("FoursquarePassword");

   logged_in = roadmap_foursquare_logged_in();

   if (!strcasecmp((const char*) ssd_dialog_get_data("FoursquareSendLogin"),
        yesno[0]))
      roadmap_foursquare_enable_tweet_login();
   else
      roadmap_foursquare_disable_tweet_login();

   if (!strcasecmp((const char*) ssd_dialog_get_data("FoursquareSendBadgeUnlock"),
        yesno[0]))
      roadmap_foursquare_enable_tweet_badge();
   else
      roadmap_foursquare_disable_tweet_badge();


   if (user_name[0] != 0 && password[0] != 0) {
      roadmap_foursquare_set_username(user_name);
      roadmap_foursquare_set_password(password);
      roadmap_foursquare_login (user_name, password);
      return 1;
   } else if (!logged_in){
      if (user_name[0] == 0) {
         roadmap_main_set_periodic (100, foursquare_un_empty);
         return 1;
      }

      if (password[0] == 0) {
         roadmap_main_set_periodic (100, foursquare_pw_empty);
         return 1;
      }
   }

   return 0;
}
示例#3
0
static int button_callback (SsdWidget widget, const char *new_value) {

   const char *title;
   const char *value;

   if (!strcmp(widget->name, "OK")) {
      update_range (
         ssd_widget_get_value (widget->parent, UPDATE_LEFT),
         ssd_widget_get_value (widget->parent, UPDATE_RIGHT),
         ssd_dialog_get_value (CITY_PREFIX),
         ssd_dialog_get_value (STREET_PREFIX));

      ssd_dialog_hide_current (dec_cancel);

      return 1;

   } else if (!strcmp(widget->name, "left_button")) {
      title = roadmap_lang_get (UPDATE_LEFT);
      value = ssd_widget_get_value (widget->parent, UPDATE_LEFT);
   } else {
      title = roadmap_lang_get (UPDATE_RIGHT);
      value = ssd_widget_get_value (widget->parent, UPDATE_RIGHT);
   }


#if (defined(__SYMBIAN32__) && !defined(TOUCH_SCREEN))
    ShowEditbox(title, "",
            keyboard_callback, (void *)widget, EEditBoxStandard | EEditBoxNumeric );
#else

   ssd_show_keyboard_dialog(  title,
                              NULL,
                              keyboard_callback,
                              widget);

#endif
   return 1;
}
示例#4
0
void editor_segments_fill_dialog (SelectedLine *lines, int lines_count) {

   char street_name[512];
   const char *street_type = "";
   const char *t2s = "";
   const char *city = "";
   int cfcc = ROADMAP_ROAD_LAST;
   int same_street = 1;
   int same_city = 1;
   int i;

   strcpy (street_name, "");
   for (i=0; i<lines_count; i++) {
      
      const char *this_name = "";
      const char *this_type = "";
      const char *this_t2s = "";
      const char *this_city = "";

      if (lines[i].line.plugin_id == EditorPluginID) {
         if (editor_db_activate (lines[i].line.fips) != -1) {

            int street_id = -1;
            
            editor_line_get_street (lines[i].line.line_id, &street_id);

            this_name = editor_street_get_street_fename (street_id);
            this_type = editor_street_get_street_fetype (street_id);
            this_t2s = editor_street_get_street_t2s (street_id);
            this_city = editor_street_get_street_city (street_id);
				//editor_line_get_direction (lines[i].line.line_id, &this_direction);
         }
      } else { 

         RoadMapStreetProperties properties;

         if (roadmap_locator_activate (lines[i].line.fips) < 0) {
            continue;
         }

         roadmap_square_set_current (lines[i].line.square);
         roadmap_street_get_properties (lines[i].line.line_id, &properties);
    
         this_name = roadmap_street_get_street_name (&properties);
         this_type = roadmap_street_get_street_fetype (&properties);
         this_t2s = roadmap_street_get_street_t2s (&properties);

         this_city = roadmap_street_get_street_city
               (&properties, ROADMAP_STREET_LEFT_SIDE);
/*
			if (!editor_override_line_get_direction (lines[0].line.line_id, &this_direction)) {

            this_direction =
               roadmap_line_route_get_direction
                  (lines[i].line.line_id, ROUTE_CAR_ALLOWED);
            roadmap_line_route_get_speed_limit
                  (lines[i].line.line_id,
                   &this_speed_limit, &this_speed_limit);
         }
*/         
      }

      if (same_street) {
         if (!strlen(street_type)) {
            street_type = this_type;
         }

         if (!strlen(t2s)) {
            t2s = this_t2s;
         }

         if (!strlen(street_name)) {
            strncpy_safe (street_name, this_name, 512);
         } else {
            if (strlen(this_name) && strcmp(this_name, street_name)) {
               strcpy (street_name, "");
               street_type = "";
               t2s = "";
               same_street = 0;
            }
         }
       }

      if (same_city) {
         if (!strlen(city)) {
            city = this_city;
         } else {
            if (strlen(this_city) && strcmp(this_city, city)) {
               same_city = 0;
               city = "";
            }
         }
      } 
      
      if (lines[i].line.cfcc < cfcc) {
         cfcc = lines[i].line.cfcc;
      }
   }

   if (same_city && !strlen(city)) {
      
      city = editor_segments_find_city
             (lines[0].line.line_id, lines[0].line.plugin_id, lines[0].line.square);
   }

#ifdef SSD
   ssd_dialog_set_data ("Road type", (void *) (long)(cfcc - ROADMAP_ROAD_FIRST));
   ssd_dialog_set_value ("Name", street_name);
   ssd_dialog_set_value ("Text to Speech", t2s);

   ssd_dialog_set_value ("City", city);

   def_values[0] = ssd_dialog_get_value ("City");

#else
   roadmap_dialog_set_data
      ("General", "Road type", (void *) (cfcc - ROADMAP_ROAD_FIRST));
   roadmap_dialog_set_data ("General", "Street type", street_type);
   roadmap_dialog_set_data ("General", "Name", street_name);
   roadmap_dialog_set_data ("General", "Text to Speech", t2s);

   roadmap_dialog_set_data ("General", "City", city);

#endif


}
示例#5
0
static int editor_segments_apply (SsdWidget widget, const char *new_value) {
   DialogSelectedLines *selected_lines =
      (DialogSelectedLines *) ssd_dialog_context ();
#else
static void editor_segments_apply (const char *name, void *context) {
   DialogSelectedLines *selected_lines = (DialogSelectedLines *)context;
#endif


   int i;
#ifdef SSD
   long type = (long) ssd_dialog_get_data ("Road type");
   int cfcc = type + ROADMAP_ROAD_FIRST;
   
   char *street_type = (char *) ssd_dialog_get_value ("Street type");
   
   char *street_name = (char *) ssd_dialog_get_value ("Name");
   
   char *t2s = (char *) ssd_dialog_get_value ("Text to Speech");
   
   char *city = (char *) ssd_dialog_get_value ("City");
#else   
   int type = (int) roadmap_dialog_get_data ("General", "Road type");
   int cfcc = type + ROADMAP_ROAD_FIRST;
   int direction = (int) roadmap_dialog_get_data ("General", "Direction");
   
   char *street_type =
      (char *) roadmap_dialog_get_data ("General", "Street type");
   
   char *street_name =
      (char *) roadmap_dialog_get_data ("General", "Name");
   
   char *t2s =
      (char *) roadmap_dialog_get_data ("General", "Text to Speech");
   
/*   char *street_range =
      (char *) roadmap_dialog_get_data ("General", "Street range"); */

   char *city = (char *) roadmap_dialog_get_data ("General", "City");
   char *zip = (char *) roadmap_dialog_get_data ("General", "Zip code");

   char *speed_limit_str =
      (char *) roadmap_dialog_get_data ("General", "Speed Limit");
#endif

   int street_id = editor_street_create (street_name, street_type, "", "", city, t2s);
	
   for (i=0; i<selected_lines->count; i++) {

      SelectedLine *line = &selected_lines->lines[i];

      if (line->line.plugin_id != EditorPluginID) {

			if (roadmap_square_scale (line->line.square) == 0 &&
				 !roadmap_street_line_has_predecessor (&line->line)) {
			
				line->line.cfcc = cfcc;
				editor_line_copy (&line->line, street_id);	
			}
			roadmap_square_set_current (line->line.square);
			editor_override_line_set_flag (line->line.line_id, line->line.square,  ED_LINE_DELETED);
      } else {
      
      	editor_line_modify_properties (line->line.line_id, cfcc, ED_LINE_DIRTY);
      	editor_line_set_street (line->line.line_id, street_id);	
      }

      
   }

   editor_screen_reset_selected ();
   editor_report_segments ();

#ifdef SSD
   ssd_dialog_hide_current (dec_close);
   return 1;
#else
   free (context);
   roadmap_dialog_hide (name);
#endif
}