;Programme de gestion de fichiers
If OpenWindow(0, 0, 0, 1200, 670, "Gestion de fichiers", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) Resultat = ExplorerComboGadget(0, 2, 2, 250, 20, "/home/mm/",#PB_Explorer_Editable) Resultat = ExplorerComboGadget(3, 700, 2, 250, 20, "/home/mm/",#PB_Explorer_Editable) Resultat = ExplorerListGadget(1, 2, 30, 490, 560, "/home/mm/",#PB_Explorer_MultiSelect | #PB_Explorer_AutoSort) Resultat = ExplorerListGadget(2, 700, 30, 490, 560, "/home/mm/",#PB_Explorer_MultiSelect | #PB_Explorer_AutoSort) TextGadget(5,2,600,490,20,"-----",#PB_Text_Border) TextGadget(6,700,600,490,20,"-----",#PB_Text_Border) ButtonGadget(29,510,600,165,30,"Quitter") ButtonGadget(10,510,30,165,22,"Home") ButtonGadget(11,510,50,165,22,"Racine") ButtonGadget(12,510,70,165,22,"Media") ButtonGadget(13,510,90,165,22,"/usr/bin") ButtonGadget(14,510,120,165,22,"Copier >>") ButtonGadget(16,510,220,165,22,"Renommer") ButtonGadget(17,510,167,165,22,"<< Effacer") ButtonGadget(18,510,240,165,22,"Creer nouveau repertoire") ButtonGadget(15,510,260,165,22,"<< Detruit repertoire") ButtonGadget(19,510,570,20,22,"o") ButtonGadget(20,655,570,20,22,"o") ButtonGadget(21,530,570,20,22,"n") ButtonGadget(22,635,570,20,22,"n") ButtonGadget(23,510,340,165,22,"Ouvrir avec..") ButtonGadget(24,510,520,80,22,"Terminal") ButtonGadget(25,595,520,80,22,"Xterm") ButtonGadget(26,510,320,165,22,"Executer") ButtonGadget(28,510,143,165,22,"Copie rep. >>") ButtonGadget(50,510,285,165,22,"Attr. fich") GadgetToolTip(14,"Copie le fichier selectionne de la fenetre origine (gauche) vers la fenetre destination (droite)") GadgetToolTip(15,"Attention ! destruction recursive des repertoires sans possibilite de retour en arriere") GadgetToolTip(16,"Entrer prealablement le nouveau nom dans la ligne de saisie") GadgetToolTip(17,"Detruit le fichier selectionne dans la fenetre origine") GadgetToolTip(18,"Entrer prealablement le nom du repertoire dans la ligne de saisie") GadgetToolTip(23,"Selectionner prealablement le fichier executable dans la liste ci-dessous") GadgetToolTip(28,"Recopie le CONTENU du repertoire dans le repertoire selectionne de la fenetre destination - Creer un repertoire si necessaire -") ComboBoxGadget(42,255,2,165,22) AddGadgetItem(42,-1,"") AddGadgetItem(42,-1,"/home/mm/Applications/") AddGadgetItem(42,-1,"home/mm/Applications/purebasic/compilers/") AddGadgetItem(42,-1,"/home/mm/Applications/blocnotes/") AddGadgetItem(42,-1,"/home/mm/Applications/tkspider/") AddGadgetItem(42,-1,"/home/mm/Applications/util/") AddGadgetItem(42,-1,"/home/mm/Documents/") AddGadgetItem(42,-1,"/home/mm/Téléchargements/") AddGadgetItem(42,-1,"/home/mm/.config/") AddGadgetItem(42,-1,"/home/mm/.wine/") ComboBoxGadget(40,510,365,165,30) AddGadgetItem(40,-1,"") AddGadgetItem(40,-1,"gedit") AddGadgetItem(40,-1,"file-roller") AddGadgetItem(40,-1,"gpicview") AddGadgetItem(40,-1,"vlc") AddGadgetItem(40,-1,"evince") AddGadgetItem(40,-1,"abiword") AddGadgetItem(40,-1,"wine") ComboBoxGadget(41,510,480,150,30) GadgetToolTip(41,"Applications courantes") ButtonGadget(27,660,480,15,30,"") AddGadgetItem(41,-1,"") AddGadgetItem(41,-1,"gedit") AddGadgetItem(41,-1,"abiword") AddGadgetItem(41,-1,"gimp") AddGadgetItem(41,-1,"galculator") AddGadgetItem(41,-1,"gnumeric") AddGadgetItem(41,-1,"inkscape") AddGadgetItem(41,-1,"qcad") AddGadgetItem(41,-1,"audacity") AddGadgetItem(41,-1,"google-chrome") AddGadgetItem(41,-1,"sylpheed") TextGadget(30,510,10,165,20,"Origine",#PB_Text_Center|#PB_Text_Border) TextGadget(33,510,545,165,20,"Fichiers caches",#PB_Text_Center|#PB_Text_Border) StringGadget(35, 510, 200, 165, 20, "") TextGadget(36,10 , 640, 1160, 20, "",#PB_Text_Border) SetGadgetColor(36,#PB_Gadget_BackColor, $90EE90) ; ----------------------------------------------- ; Boucles de gestion des évènements ; ----------------------------------------------- Repeat event = WaitWindowEvent() If event = #PB_Event_Gadget If EventGadget() = 1 SetGadgetText(0, GetGadgetText(1)) If GetGadgetState(1) <> -1 SetGadgetText(5, GetGadgetText(0) + GetGadgetItemText(1,GetGadgetState(1))) EndIf If GetGadgetState(1) = -1 SetGadgetText(5, GetGadgetText(0)) EndIf EndIf If EventGadget() = 2 SetGadgetText(3, GetGadgetText(2)) SetGadgetText(6, GetGadgetText(3)) EndIf If EventGadget() = 0 SetGadgetText(1,GetGadgetText(0)) SetGadgetText(5, GetGadgetText(0)) EndIf If EventGadget() = 3 SetGadgetText(2,GetGadgetText(3)) SetGadgetText(6, GetGadgetText(3)) EndIf If EventGadget() = 10 SetGadgetText(1,"/home/mm/") EndIf If EventGadget() = 11 SetGadgetText(1,"/") EndIf If EventGadget() = 12 SetGadgetText(1,"/media/") EndIf If EventGadget() = 13 SetGadgetText(1,"/usr/bin/") EndIf If EventGadget() = 14 Resultat = CopyFile(GetGadgetText(5), GetGadgetText(6) + GetGadgetItemText(1,GetGadgetState(1))) SetGadgetText(2,"*") If Resultat = 0 SetGadgetText(36,"Copie ratee") EndIf If Resultat = 1 SetGadgetText(36,"Copie reussie") EndIf EndIf If EventGadget() = 15 Resultat = DeleteDirectory(GetGadgetText(5),"*",#PB_FileSystem_Recursive) SetGadgetText(1,"*") If Resultat = 0 SetGadgetText(36,"Repertoire non detruit") EndIf If Resultat = 1 SetGadgetText(36,"suppression reussie") EndIf EndIf If EventGadget() = 16 Resultat =RenameFile(GetGadgetText(5),GetGadgetText(1) + "/" +GetGadgetText(35)) SetGadgetText(1,"*") If Resultat = 0 SetGadgetText(36,"Operation ratee !") EndIf If Resultat = 1 SetGadgetText(36,GetGadgetText(5) +" "+ GetGadgetText(1) + "/" +GetGadgetText(35) + " operation reussie") EndIf EndIf If EventGadget() = 17 Resultat = DeleteFile(GetGadgetText(5)) SetGadgetText(1,"*") If Resultat = 0 SetGadgetText(36,"fichier non efface") EndIf If Resultat = 1 SetGadgetText(36,"suppression reussie") EndIf EndIf If EventGadget() = 18 Resultat = CreateDirectory(GetGadgetText(5) + "/" + GetGadgetText(35)) SetGadgetText(1,"*") If Resultat = 0 SetGadgetText(36,"repertoire non cree") EndIf If Resultat = 1 SetGadgetText(36,GetGadgetText(5) + "/" + GetGadgetText(35) + " creation reussie") EndIf EndIf If EventGadget() = 19 SetGadgetAttribute(1,#PB_Explorer_HiddenFiles,1) EndIf If EventGadget() = 20 SetGadgetAttribute(2,#PB_Explorer_HiddenFiles,1) EndIf If EventGadget() = 21 SetGadgetAttribute(1,#PB_Explorer_HiddenFiles,0) EndIf If EventGadget() = 22 SetGadgetAttribute(2,#PB_Explorer_HiddenFiles,0) EndIf If EventGadget() = 23 RunProgram(GetGadgetText(40), GetGadgetText(5), "./") SetGadgetText(36,GetGadgetText(40) + " " + GetGadgetText(5)) EndIf If EventGadget() = 24 RunProgram("lxterminal", "-e", GetGadgetText(1)) EndIf If EventGadget() = 25 RunProgram("xterm", "", GetGadgetText(1)) EndIf If EventGadget() = 26 RunProgram(GetGadgetText(5)) EndIf If EventGadget() = 27 RunProgram(GetGadgetText(41)) EndIf If EventGadget() = 42 SetGadgetText(0, GetGadgetText(42)) If GetGadgetState(1) <> -1 SetGadgetText(5, GetGadgetText(0) + GetGadgetItemText(1,GetGadgetState(1))) EndIf If GetGadgetState(1) = -1 SetGadgetText(5, GetGadgetText(0)) EndIf SetGadgetText(1,GetGadgetText(0)) SetGadgetText(5, GetGadgetText(0)) EndIf If EventGadget() = 28 Resultat = CopyDirectory(GetGadgetText(5), GetGadgetText(3), "*",#PB_FileSystem_Recursive) SetGadgetText(2,"*") SetGadgetText(36,GetGadgetText(5) +" vers "+GetGadgetText(3)) If Resultat = 0 SetGadgetText(36,"Copie ratee") EndIf If Resultat = 1 SetGadgetText(36,"Copie reussie") EndIf EndIf If EventGadget() = 29 End EndIf If EventGadget() = 50 texte$="" Attributs.l = GetFileAttributes(GetGadgetText(5)) If Attributs = -1 SetGadgetText(36,"Erreur de lecture des attributs fichier !") Else If Attributs & #PB_FileSystem_Link : texte$ + " Lien symbolique " : EndIf texte$=" Executable " If Attributs & #PB_FileSystem_ExecAll : texte$ + "x " : Else : texte$+"- " : EndIf If Attributs & #PB_FileSystem_ExecGroup : texte$ + "x " : Else : texte$+"- " : EndIf If Attributs & #PB_FileSystem_ExecUser : texte$ + "x " : Else : texte$+"- " : EndIf texte$ + " Lecture " If Attributs & #PB_FileSystem_ReadAll : texte$ + "r " : Else : texte$+"- " : EndIf If Attributs & #PB_FileSystem_ReadGroup : texte$ + "r " : Else : texte$+"- " : EndIf If Attributs & #PB_FileSystem_ReadUser : texte$ + "r " : Else : texte$+"- " : EndIf texte$ + " Ecriture " If Attributs & #PB_FileSystem_WriteAll : texte$ + "w " : Else : texte$+"- " : EndIf If Attributs & #PB_FileSystem_WriteGroup : texte$ + "w " : Else : texte$+"- " : EndIf If Attributs & #PB_FileSystem_WriteUser : texte$ + "w " : Else : texte$+"- " : EndIf SetGadgetText(36, texte$) EndIf EndIf EndIf Until WindowEvent() = #PB_Event_CloseWindow EndIf
|