1828 self updateCurrentDirectory |
1828 self updateCurrentDirectory |
1829 |
1829 |
1830 "Modified: / 4.8.1998 / 13:45:46 / cg" |
1830 "Modified: / 4.8.1998 / 13:45:46 / cg" |
1831 ! |
1831 ! |
1832 |
1832 |
|
1833 confirmAndRemove:fileNames |
|
1834 "remove fileNames with user confirmation. |
|
1835 TODO: Should be enhanced, to look for a ~/.trash directory |
|
1836 and move files there if it exists (without asking in this case)." |
|
1837 |
|
1838 |q doRemove| |
|
1839 |
|
1840 "/ do not ask, if shift is pressed |
|
1841 fileNames size > 1 ifTrue:[ |
|
1842 q := resources string:'Remove %1 selected files ?' with:(fileNames size). |
|
1843 doRemove := Dialog |
|
1844 confirmWithCancel:q |
|
1845 labels:(resources array:#('Cancel' 'Confirm Each' 'Remove')) |
|
1846 values:#(false #confirm true) |
|
1847 default:3. |
|
1848 doRemove isNil ifTrue:[^ self]. |
|
1849 doRemove == #confirm ifTrue:[ |
|
1850 fileNames do:[:eachFileName | |
|
1851 self confirmAndRemove:(Array with:eachFileName). |
|
1852 ]. |
|
1853 ^ self. |
|
1854 ]. |
|
1855 ] ifFalse:[ |
|
1856 q := resources string:'Remove ''%1'' ?' with:(fileNames first allBold). |
|
1857 doRemove := self ask:q yesButton:'Remove'. |
|
1858 ]. |
|
1859 |
|
1860 doRemove ifTrue:[ |
|
1861 self doRemove:fileNames |
|
1862 ] |
|
1863 ! |
|
1864 |
1833 detailsSettingChanged |
1865 detailsSettingChanged |
1834 "invoked, when detail (i.e. long / short) listing flag changed" |
1866 "invoked, when detail (i.e. long / short) listing flag changed" |
1835 |
1867 |
1836 self showOrHideTabView. |
1868 self showOrHideTabView. |
1837 self bigImagePreviewSettingChanged |
1869 self bigImagePreviewSettingChanged |
2701 "Modified: 18.9.1997 / 16:29:17 / stefan" |
2733 "Modified: 18.9.1997 / 16:29:17 / stefan" |
2702 ! |
2734 ! |
2703 |
2735 |
2704 fileRemove |
2736 fileRemove |
2705 "remove the selected file(s). |
2737 "remove the selected file(s). |
2706 Query if user really wants to remove the file. |
2738 Query if user really wants to remove the file, except if |
2707 - should be enhanced, to look for a ~/.trash directory |
2739 shift-key is pressed. |
2708 and move files there if it exists (without asking in this case)." |
2740 TODO: Should be enhanced, to look for a ~/.trash directory |
2709 |
2741 and move files there if it exists (without asking in this case)." |
2710 |sel q| |
2742 |
|
2743 |sel| |
2711 |
2744 |
2712 sel := fileListView selection. |
2745 sel := fileListView selection. |
2713 sel size > 0 ifTrue:[ |
2746 sel size > 0 ifTrue:[ |
2714 sel := sel collect:[:rawIndex | fileList at:rawIndex]. |
2747 sel := sel collect:[:rawIndex | fileList at:rawIndex]. |
2715 sel size > 1 ifTrue:[ |
2748 "/ do not ask, if shift is pressed |
2716 q := resources string:'Remove %1 selected files ?' with:(sel size) |
2749 self sensor shiftDown ifTrue:[ |
|
2750 self doRemove:sel |
2717 ] ifFalse:[ |
2751 ] ifFalse:[ |
2718 q := resources string:'Remove ''%1'' ?' with:(sel first allBold) |
2752 self confirmAndRemove:sel |
2719 ]. |
2753 ]. |
2720 (self sensor shiftDown |
2754 ] |
2721 or:[self ask:q yesButton:'Remove']) ifTrue:[ |
2755 ! |
2722 self withCursor:(Cursor wait) do:[ |
2756 |
2723 self doRemove:sel |
2757 fileRemove:fileNames |
2724 ] |
2758 "remove fileNames. |
|
2759 Query if user really wants to remove the file, except if |
|
2760 shift-key is pressed. |
|
2761 TODO: Should be enhanced, to look for a ~/.trash directory |
|
2762 and move files there if it exists (without asking in this case)." |
|
2763 |
|
2764 |q doRemove| |
|
2765 |
|
2766 "/ do not ask, if shift is pressed |
|
2767 doRemove := self sensor shiftDown. |
|
2768 doRemove ifFalse:[ |
|
2769 fileNames size > 1 ifTrue:[ |
|
2770 q := resources string:'Remove %1 selected files ?' with:(fileNames size). |
|
2771 doRemove := Dialog |
|
2772 confirmWithCancel:q |
|
2773 labels:(resources array:#('Remove' 'Confirm Each' 'Cancel')) |
|
2774 values:#(true #confirm false) |
|
2775 default:true. |
|
2776 doRemove == #confirm ifTrue:[ |
|
2777 self halt. |
|
2778 ]. |
|
2779 ] ifFalse:[ |
|
2780 q := resources string:'Remove ''%1'' ?' with:(fileNames first allBold). |
|
2781 doRemove := self ask:q yesButton:'Remove'. |
|
2782 ]. |
|
2783 ]. |
|
2784 |
|
2785 doRemove ifTrue:[ |
|
2786 self withWaitCursorDo:[ |
|
2787 self doRemove:fileNames |
2725 ] |
2788 ] |
2726 ] |
2789 ] |
2727 |
|
2728 "Modified: / 16.12.1998 / 17:30:31 / cg" |
|
2729 ! |
2790 ! |
2730 |
2791 |
2731 fileRename |
2792 fileRename |
2732 "rename the selected file(s)" |
2793 "rename the selected file(s)" |
2733 |
2794 |
6006 doRemove:filesToRemove |
6067 doRemove:filesToRemove |
6007 "remove the selected file(s) - no questions asked" |
6068 "remove the selected file(s) - no questions asked" |
6008 |
6069 |
6009 |msg needUpdate toRemove updateRunning yesToAll mTime| |
6070 |msg needUpdate toRemove updateRunning yesToAll mTime| |
6010 |
6071 |
6011 updateRunning := listUpdateProcess notNil. |
6072 self withWaitCursorDo:[ |
6012 self stopUpdateProcess. |
6073 updateRunning := listUpdateProcess notNil. |
6013 toRemove := OrderedCollection new. |
6074 self stopUpdateProcess. |
6014 |
6075 toRemove := OrderedCollection new. |
6015 "/ |
6076 |
6016 "/ did the directory change in the meanwhile ? |
6077 "/ |
6017 "/ |
6078 "/ did the directory change in the meanwhile ? |
6018 mTime := currentDirectory modificationTime. |
6079 "/ |
6019 needUpdate := mTime notNil and:[mTime > timeOfLastCheck]. |
6080 mTime := currentDirectory modificationTime. |
6020 |
6081 needUpdate := mTime notNil and:[mTime > timeOfLastCheck]. |
6021 yesToAll := false. |
6082 |
6022 lockUpdate := true. |
6083 yesToAll := false. |
6023 [ |
6084 lockUpdate := true. |
6024 filesToRemove keysAndValuesDo:[:idx :fileName | |
6085 [ |
6025 |f| |
6086 filesToRemove keysAndValuesDo:[:idx :fileName | |
6026 |
6087 |f| |
6027 f := currentDirectory construct:fileName. |
6088 |
6028 OperatingSystem accessDeniedErrorSignal handle:[:ex| |
6089 f := currentDirectory construct:fileName. |
6029 "was not able to remove it" |
6090 OperatingSystem accessDeniedErrorSignal handle:[:ex| |
6030 msg := (resources string:'cannot remove ''%1'' !!' with:fileName). |
6091 "was not able to remove it" |
6031 self showAlert:msg with:(OperatingSystem lastErrorString) |
6092 msg := (resources string:'cannot remove ''%1'' !!' with:fileName). |
6032 ] do:[ |
6093 self showAlert:msg with:(OperatingSystem lastErrorString) |
6033 |answer contents i| |
6094 ] do:[ |
6034 |
6095 |answer contents i| |
6035 (f isSymbolicLink not and:[f isDirectory]) ifTrue:[ |
6096 |
6036 contents := f directoryContents. |
6097 (f isSymbolicLink not and:[f isDirectory]) ifTrue:[ |
6037 contents isEmpty ifTrue:[ |
6098 contents := f directoryContents. |
6038 f remove |
6099 contents isEmpty ifTrue:[ |
|
6100 f remove |
|
6101 ] ifFalse:[ |
|
6102 yesToAll ifFalse:[ |
|
6103 idx == filesToRemove size ifTrue:[ |
|
6104 answer := Dialog |
|
6105 confirmWithCancel:(resources string:'directory ''%1'' is not empty\remove anyway ?' with:fileName allBold) withCRs |
|
6106 labels:(resources array:#('cancel' 'remove')) |
|
6107 values:#(false true) |
|
6108 default:2. |
|
6109 ] ifFalse:[ |
|
6110 answer := Dialog |
|
6111 confirmWithCancel:(resources string:'directory ''%1'' is not empty\remove anyway ?' with:fileName allBold) withCRs |
|
6112 labels:(resources array:#('cancel' 'remove all' 'remove')) |
|
6113 values:#(false #removeAll true) |
|
6114 default:3. |
|
6115 ]. |
|
6116 answer == false ifTrue:[ |
|
6117 ^ self |
|
6118 ]. |
|
6119 answer == #removeAll ifTrue:[ |
|
6120 yesToAll := true |
|
6121 ]. |
|
6122 ]. |
|
6123 f recursiveRemove |
|
6124 ]. |
6039 ] ifFalse:[ |
6125 ] ifFalse:[ |
6040 yesToAll ifFalse:[ |
6126 f removeFile. |
6041 idx == filesToRemove size ifTrue:[ |
|
6042 answer := Dialog |
|
6043 confirmWithCancel:(resources string:'directory ''%1'' is not empty\remove anyway ?' with:fileName allBold) withCRs |
|
6044 labels:(resources array:#('cancel' 'remove')) |
|
6045 values:#(false true) |
|
6046 default:2. |
|
6047 ] ifFalse:[ |
|
6048 answer := Dialog |
|
6049 confirmWithCancel:(resources string:'directory ''%1'' is not empty\remove anyway ?' with:fileName allBold) withCRs |
|
6050 labels:(resources array:#('cancel' 'remove all' 'remove')) |
|
6051 values:#(false #removeAll true) |
|
6052 default:3. |
|
6053 ]. |
|
6054 answer == false ifTrue:[ |
|
6055 ^ self |
|
6056 ]. |
|
6057 answer == #removeAll ifTrue:[ |
|
6058 yesToAll := true |
|
6059 ]. |
|
6060 ]. |
|
6061 f recursiveRemove |
|
6062 ]. |
6127 ]. |
6063 ] ifFalse:[ |
6128 " |
6064 f removeFile. |
6129 self show:nil |
|
6130 " |
|
6131 i := fileList indexOf:fileName. |
|
6132 i ~~ 0 ifTrue:[ |
|
6133 toRemove add:i. |
|
6134 ] |
6065 ]. |
6135 ]. |
6066 " |
|
6067 self show:nil |
|
6068 " |
|
6069 i := fileList indexOf:fileName. |
|
6070 i ~~ 0 ifTrue:[ |
|
6071 toRemove add:i. |
|
6072 ] |
|
6073 ]. |
6136 ]. |
6074 ]. |
6137 ] valueNowOrOnUnwindDo:[ |
6075 ] valueNowOrOnUnwindDo:[ |
6138 lockUpdate := false. |
6076 lockUpdate := false. |
6139 fileListView setSelection:nil. |
6077 fileListView setSelection:nil. |
6140 |
6078 |
6141 "/ |
6079 "/ |
6142 "/ remove reverse - otherwise indices are wrong |
6080 "/ remove reverse - otherwise indices are wrong |
6143 "/ |
6081 "/ |
6144 toRemove sort. |
6082 toRemove sort. |
6145 toRemove reverseDo:[:idx | |
6083 toRemove reverseDo:[:idx | |
6146 fileList removeIndex:idx. |
6084 fileList removeIndex:idx. |
6147 fileListView removeIndex:idx. |
6085 fileListView removeIndex:idx. |
6148 ]. |
6086 ]. |
6149 |
6087 |
6150 updateRunning ifTrue:[ |
6088 updateRunning ifTrue:[ |
6151 self updateCurrentDirectory |
6089 self updateCurrentDirectory |
6152 ] ifFalse:[ |
6090 ] ifFalse:[ |
6153 " |
6091 " |
6154 install a new check after some time |
6092 install a new check after some time |
6155 " |
6093 " |
6156 needUpdate ifFalse:[timeOfLastCheck := AbsoluteTime now]. |
6094 needUpdate ifFalse:[timeOfLastCheck := AbsoluteTime now]. |
6157 Processor removeTimedBlock:checkBlock. |
6095 Processor removeTimedBlock:checkBlock. |
6158 Processor addTimedBlock:checkBlock afterSeconds:checkDelta. |
6096 Processor addTimedBlock:checkBlock afterSeconds:checkDelta. |
6159 ] |
6097 ] |
6160 ] |
6098 ] |
6161 ] |
6099 |
6162 |
6100 "Modified: / 20.11.1997 / 17:39:14 / stefan" |
6163 "Modified: / 20.11.1997 / 17:39:14 / stefan" |
6101 "Modified: / 26.4.1999 / 23:03:12 / cg" |
6164 "Modified: / 26.4.1999 / 23:03:12 / cg" |