Changeset 38874
- Timestamp:
- 09/18/16 13:38:52 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
titan/plugins/multiimage/MultiImage.c
r38871 r38874 56 56 system(cmd); 57 57 free(cmd); cmd = NULL; 58 58 59 59 } 60 60 else … … 78 78 char* mdev = NULL; 79 79 char* path = NULL; 80 80 81 81 char* pos = NULL; 82 82 FILE* fd = NULL; … … 118 118 } 119 119 free(fileline); 120 fclose(fd); 120 fclose(fd); 121 121 122 122 return mdev; … … 131 131 char* cmd = NULL; 132 132 struct skin* tmp = NULL; 133 int ret = 0; 134 int rcret = 0; 133 int ret = 0; 134 int rcret = 0; 135 135 int ren = 0; 136 136 137 137 struct skin* multipart = getscreen("multipart"); 138 138 struct skin* listbox = getscreennode(multipart, "listbox"); 139 139 struct skin* device = getscreennode(multipart, "device"); 140 140 struct skin* text2 = getscreennode(multipart, "textbox2"); 141 141 142 142 char* pos = NULL; 143 143 FILE* fd = NULL; … … 170 170 } 171 171 free(fileline); 172 fclose(fd); 172 fclose(fd); 173 173 if(mdev == NULL) 174 174 { … … 180 180 path = ostrcat(path, "/", 0, 0); 181 181 path = ostrcat(path, mdev, 1, 0); 182 182 183 183 dirall = get_dir(path); 184 184 free(path); path = NULL; 185 185 186 186 changetext(text2, dirall); 187 187 free(dirall); dirall = NULL; 188 188 189 189 free(mdev); mdev=NULL; 190 190 191 191 drawscreen(multipart, 0, 0); 192 192 addscreenrc(multipart, listbox); … … 196 196 addscreenrc(multipart, tmp); 197 197 rcret = waitrc(multipart, 2000, 0); 198 tmp = listbox->select; 198 tmp = listbox->select; 199 199 if(rcret == getrcconfigint("rcexit", NULL)) break; 200 200 201 201 if((rcret == getrcconfigint("rcleft", NULL) || rcret == getrcconfigint("rcright", NULL)) && listbox->select != NULL && ostrcmp(listbox->select->name, "device") == 0) 202 202 { … … 227 227 path = ostrcat(path, "/", 0, 0); 228 228 path = ostrcat(path, mdev, 1, 0); 229 229 230 230 cmd = ostrcat("mount | grep ", mdev, 0, 0); 231 231 cmd = ostrcat(cmd, " | grep ext[2,3,4]", 1, 0); … … 242 242 else 243 243 { 244 textbox( "ERROR", _("No Linux partition found on this device."), _("OK"), getrcconfigint("rcok", NULL),NULL, 0, NULL, 0, NULL, 0, 600, 200, 0, 0);244 textbox(_("ERROR"), _("No Linux partition found on this device."), _("OK"), getrcconfigint("rcok", NULL),NULL, 0, NULL, 0, NULL, 0, 600, 200, 0, 0); 245 245 ren = 0; 246 246 } … … 249 249 if(ren == 1) 250 250 break; 251 } 251 } 252 252 drawscreen(multipart, 0, 0); 253 253 } 254 254 delownerrc(multipart); 255 255 clearscreen(multipart); 256 256 257 257 if(mdev == NULL) 258 return 1; 259 258 return 1; 259 260 260 if(ren != 1) 261 { 261 { 262 262 if(textbox("MultiImage", _("All data on this device will be deleted!\nOK?"), _("OK"), getrcconfigint("rcok", NULL), _("EXIT"), getrcconfigint("rcexit", NULL), NULL, 0, NULL, 0, 650, 200, 0, 0) == 2) 263 263 { … … 290 290 free(mdev); mdev = NULL; 291 291 system ("echo MultiImage > /dev/vfd"); 292 } 293 292 } 293 294 294 return 0; 295 295 } 296 296 297 297 // type 1 = install image 298 298 // type 2 = rename image … … 324 324 changeinput(imagename, imagefile); 325 325 } 326 326 327 327 path = getconfig("mountpath", NULL); 328 328 path = ostrcat(path, "/", 0, 0); … … 331 331 path2 = ostrcat(path, "/", 0, 0); 332 332 path2 = ostrcat(path2,"titan_multi", 1, 0); 333 333 334 334 changetext(text1, imagefile); 335 336 335 336 337 337 drawscreen(multiinstall, 0, 0); 338 338 addscreenrc(multiinstall, listbox); … … 342 342 addscreenrc(multiinstall, tmp); 343 343 rcret = waitrc(multiinstall, 2000, 0); 344 tmp = listbox->select; 344 tmp = listbox->select; 345 345 if(rcret == getrcconfigint("rcexit", NULL)) 346 346 break; … … 404 404 } 405 405 406 free(path); path=NULL; 407 free(path2); path2=NULL; 408 free(path3); path3=NULL; 406 free(path); path=NULL; 407 free(path2); path2=NULL; 408 free(path3); path3=NULL; 409 409 return rc; 410 410 } … … 415 415 char* path = NULL; 416 416 char* cmd = NULL; 417 char* tmpstr = NULL; 417 char* tmpstr = NULL; 418 418 char* selimage = NULL; 419 struct dirent* dirzeiger; 419 struct dirent* dirzeiger; 420 420 DIR *dir = NULL; 421 int rcret = 0; 421 int rcret = 0; 422 422 int rc = 0; 423 423 int test = 0; 424 424 int test2 = 0; 425 425 426 426 struct skin* multiimage = getscreen("multiimage"); 427 427 struct skin* listbox = getscreennode(multiimage, "listbox"); 428 428 struct skin* images = getscreennode(multiimage, "images"); 429 429 struct skin* chnode1 = NULL; 430 430 431 431 path = getconfig("mountpath", NULL); 432 432 path = ostrcat(path, "/", 0, 0); … … 434 434 path = ostrcat(path, "/", 1, 0); 435 435 path = ostrcat(path,"titan_multi", 1, 0); 436 436 437 437 delmarkedscreennodes(multiimage, 1); 438 438 listbox->aktpage = -1; 439 439 listbox->aktline = 1; 440 440 441 441 tmpstr = ostrcat(path, "/", 0, 0); 442 442 tmpstr = ostrcat(tmpstr, ".multi_image", 1, 0); 443 443 selimage = readsys(tmpstr, 1); 444 444 free(tmpstr); tmpstr=NULL; 445 445 446 446 test2 = 0; 447 447 dir = opendir(path); … … 466 466 if(selimage != NULL && ostrcmp(selimage, dirzeiger->d_name) == 0) 467 467 { 468 tmpstr = ostrcat(dirzeiger->d_name, " (selected)", 0, 0); 468 tmpstr = ostrcat(dirzeiger->d_name, " (selected)", 0, 0); 469 469 changetext(chnode1, tmpstr); 470 470 free(tmpstr); tmpstr=NULL; 471 471 test2 = 1; 472 472 } 473 else 473 else 474 474 changetext(chnode1, dirzeiger->d_name); 475 475 } … … 480 480 if(test == 0) 481 481 images->hidden = NO; 482 else 482 else 483 483 { 484 484 images->hidden = YES; … … 508 508 addscreenrc(multiimage, tmp); 509 509 rcret = waitrc(multiimage, 2000, 0); 510 tmp = listbox->select; 510 tmp = listbox->select; 511 511 if(rcret == getrcconfigint("rcok", NULL)) 512 512 { 513 513 if(listbox->select != NULL) 514 { 514 { 515 515 rc = 1; 516 516 tmpstr = ostrcat(path, "/", 0, 0); … … 529 529 { 530 530 if(listbox->select != NULL) 531 { 531 { 532 532 rc = 1; 533 533 cmd = ostrcat(_("Sure to delete Image?\n"), listbox->select->name, 0, 0); … … 558 558 { 559 559 rc = 1; 560 selimage = ostrcat(listbox->select->name, NULL, 0, 0); 560 selimage = ostrcat(listbox->select->name, NULL, 0, 0); 561 561 break; 562 562 } … … 585 585 char* imagefile = NULL; 586 586 int ret = 0; 587 587 588 588 mdev = find_multiimage_dev(); 589 589 590 590 while (mdev == NULL) 591 591 { … … 593 593 return; 594 594 if(no_mdev() != 0) 595 return; 595 return; 596 596 mdev = find_multiimage_dev(); 597 597 } … … 599 599 { 600 600 ret = multiimage_screen(mdev); 601 601 602 602 if(ret == 0) 603 603 break; … … 606 606 if(ret == 2) 607 607 { 608 textbox(_("Message"), _("The install process will look in /tmp for an image zip file.\nPlease copy the image to /tmp.\nThe filename must not contain blanks."), _("OK"), getrcconfigint("rcok", NULL), NULL, 0, NULL, 0, NULL, 0, 800, 200, 0, 0); 608 textbox(_("Message"), _("The install process will look in /tmp for an image zip file.\nPlease copy the image to /tmp.\nThe filename must not contain blanks."), _("OK"), getrcconfigint("rcok", NULL), NULL, 0, NULL, 0, NULL, 0, 800, 200, 0, 0); 609 609 imagefile = screendir("/tmp", "*.zip", NULL, NULL, NULL, NULL, 0, "SELECT", 0, NULL, 0, NULL, 0, 1200, 0, 600, 0, 0); 610 610 if(imagefile != NULL) … … 622 622 { 623 623 if(no_mdev() != 0) 624 continue; 624 continue; 625 625 free(mdev); mdev=NULL; 626 626 mdev = find_multiimage_dev(); … … 634 634 free(mdev); mdev=NULL; 635 635 } 636 637 638 636 637 638 639 639 //wird beim laden ausgefuehrt 640 640 void init(void) … … 642 642 char* tmpstr = NULL; 643 643 pluginaktiv = 1; 644 644 645 645 tmpstr = createpluginpath("/multiimage/skin.xml", 0); 646 646 readscreen(tmpstr, 122, 1);
Note: See TracChangeset
for help on using the changeset viewer.