FileBrowser.qml 18.2 KB
Newer Older
1
import QtQuick 2.9
2
import QtQuick.Controls 2.5
3
4
import QtQuick.Layouts 1.3

5
import org.kde.kirigami 2.6 as Kirigami
6
7
8
9
10
11
12
13
14
import org.kde.mauikit 1.0 as Maui

import "private"

import FMModel 1.0
import FMList 1.0

Maui.Page
{
15
16
17
18
19
20
21
	id: control
	
	/* Controlc color scheming */
	ColorScheme {id: colorScheme}
	property alias colorScheme : colorScheme
	/***************************/
	
22
23
24
	property alias trackChanges: modelList.trackChanges
	property alias saveDirProps: modelList.saveDirProps
	
25
26
	property string currentPath: Maui.FM.homePath()
	
Camilo higuita's avatar
Camilo higuita committed
27
28
	property var copyItems : []
	property var cutItems : []
29
	
30
31
	property var indexHistory : []
	
32
33
34
35
36
37
38
39
40
41
42
43
44
45
	property bool isCopy : false
	property bool isCut : false
	
	property bool selectionMode : false
	property bool group : false
	property bool showEmblems: true
	
	property alias selectionBar : selectionBarLoader.item
	
	property alias model : folderModel
	property alias list : modelList
	property alias browser : viewLoader.item
	
	property alias previewer : previewer
46
	property alias menu : browserMenu.actions
47
48
49
	property alias itemMenu: itemMenu
	property alias holder: holder
	property alias dialog : dialogLoader.item
camilo higuita's avatar
camilo higuita committed
50
	property alias goUpButton : goUpButton
51
52
53
54
55
56
57
58
59
60
	
	property alias currentPathType : modelList.pathType
	property int thumbnailsSize : iconSizes.large
	
	signal itemClicked(int index)
	signal itemDoubleClicked(int index)
	signal itemRightClicked(int index)
	signal itemLeftEmblemClicked(int index)
	signal itemRightEmblemClicked(int index)
	signal rightClicked()
61
	signal newBookmark()
62
63
64
65
66
67
68
69
70
71
72
73
74
75
	
	margins: 0
	
	Loader
	{
		id: dialogLoader
	}
	
	Component
	{
		id: removeDialogComponent
		
		Maui.Dialog
		{
Camilo higuita's avatar
Camilo higuita committed
76
			property var items: []
77
78
79
			
			title: qsTr("Delete files?")
			message: qsTr("If you are sure you want to delete the files click on Accept, otherwise click on Cancel")
80
81
82
            rejectButton.text: qsTr("Cancel")
            acceptButton.text: qsTr("Accept")
            onRejected: close()
83
84
85
86
87
88
89
90
			onAccepted:
			{
				if(control.selectionBar && control.selectionBar.visible)
				{
					control.selectionBar.clear()
					control.selectionBar.animate("red")
				}
				
Camilo higuita's avatar
Camilo higuita committed
91
				control.remove(items)
92
93
94
95
96
97
98
99
100
101
102
				close()
			}
		}
	}
	
	Component
	{
		id: newFolderDialogComponent
		
		Maui.NewDialog
		{
103
104
105
            title: qsTr("New folder")
            message: qsTr("Create a new folder with a custom name")
            acceptButton.text: qsTr("Create")
106
			onFinished: list.createDir(text)
Camilo higuita's avatar
Camilo higuita committed
107
			rejectButton.visible: false
108
109
110
111
112
113
114
115
116
		}
	}
	
	Component
	{
		id: newFileDialogComponent
		
		Maui.NewDialog
		{
117
118
119
            title: qsTr("New file")
            message: qsTr("Create a new file with a custom name and extension")
            acceptButton.text: qsTr("Create")
120
			onFinished: Maui.FM.createFile(control.currentPath, text)
Camilo higuita's avatar
Camilo higuita committed
121
			rejectButton.visible: false			
122
123
124
125
126
127
128
129
130
		}
	}
	
	Component
	{
		id: renameDialogComponent
		Maui.NewDialog
		{
			title: qsTr("Rename file")
131
            message: qsTr("Rename a file or folder to a new custom name")
132
133
			textEntry.text: list.get(browser.currentIndex).label
			textEntry.placeholderText: qsTr("New name...")
Camilo higuita's avatar
Camilo higuita committed
134
			onFinished: Maui.FM.rename(itemMenu.items[0].path, textEntry.text)
135
            onRejected: close()
136
137
138
139
140
141
142
143
144
145
146
			acceptText: qsTr("Rename")
			rejectText: qsTr("Cancel")
		}
	}
	
	Component
	{
		id: shareDialogComponent
		Maui.ShareDialog {}
	}
	
147
148
149
150
151
152
153
	Component
	{
		id: tagsDialogComponent
		Maui.TagsDialog
		{
			onTagsReady: composerList.updateToUrls(tags)
		}
Camilo higuita's avatar
fixes    
Camilo higuita committed
154
	}	
155
	
156
157
158
	BrowserMenu
	{
		id: browserMenu
159
// 		width: unit *200	
160
		z : control.z +1
161
162
163
164
165
166
	}
	
	Maui.FilePreviewer
	{
		id: previewer
		parent: parent
167
		onShareButtonClicked: control.shareFiles([url])
168
169
170
171
172
173
174
175
176
177
178
	}
	
	FMModel
	{
		id: folderModel
		list: modelList
	}
	
	FMList
	{
		id: modelList
179
		preview: true
180
		path: currentPath
181
		foldersFirst: true
182
		onSortByChanged: if(group) groupBy()
183
		onContentReadyChanged: console.log("CONTENT READY?", contentReady)
184
		onWarning:
Camilo higuita's avatar
Camilo higuita committed
185
186
		{			
			notify("dialog-information", "An error happened", message)
187
188
189
190
191
192
		}
		
		onProgress:
		{
			if(percent === 100)
				_progressBar.value = 0
Camilo higuita's avatar
Camilo higuita committed
193
194
				else
					_progressBar.value = percent/100
195
		}
196
	}	
197
	
198
199
200
	FileMenu
	{
		id: itemMenu
Camilo higuita's avatar
Camilo higuita committed
201
		width: unit *200
202
		onBookmarkClicked: control.bookmarkFolder([items[0].path])
203
204
		onCopyClicked:
		{
Camilo higuita's avatar
Camilo higuita committed
205
			if(items.length)
206
				control.copy(items)			
207
		}
Camilo higuita's avatar
Camilo higuita committed
208
		
209
210
211
		onCutClicked:
		{
			if(items.length)
212
				control.cut(items)			
213
		}
Camilo higuita's avatar
Camilo higuita committed
214
		
215
216
217
218
		onTagsClicked:
		{
			if(items.length)
			{
219
				dialogLoader.sourceComponent = tagsDialogComponent
220
				
221
222
223
224
225
226
				if(items.length > 1 && control.selectionBar)			
					dialog.composerList.urls = control.selectionBar.selectedPaths			
					else  
						dialog.composerList.urls = items[0].path
						
						dialog.open()
227
228
229
			}
		}
		
230
231
		onRenameClicked:
		{
Camilo higuita's avatar
Camilo higuita committed
232
			if(items.length === 1)
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
			{
				dialogLoader.sourceComponent = renameDialogComponent
				dialog.open()
			}
		}
		
		//        onSaveToClicked:
		//        {
		//            fmDialog.saveDialog = false
		//            fmDialog.multipleSelection = true
		//            fmDialog.onlyDirs= true
		
		//            var myPath = path
		
		//            var paths = browser.selectionBar.selectedPaths
		//            fmDialog.show(function(paths)
		//            {
		//                inx.copy(myPath, paths)
		//            })
		//        }
		
		onRemoveClicked:
		{
			dialogLoader.sourceComponent= removeDialogComponent
Camilo higuita's avatar
Camilo higuita committed
257
			dialog.items = items
258
259
260
261
			dialog.open()
		}
		
		onShareClicked:
262
263
264
265
		{			
			if(items.length)			
                control.shareFiles([items[0].path])
        }
266
267
268
269
270
271
272
273
274
	}
	
	Component
	{
		id: listViewBrowser
		
		Maui.ListBrowser
		{
			showPreviewThumbnails: modelList.preview
275
			showEmblem: selectionMode
276
			rightEmblem: isMobile ? "document-share" : ""
Camilo higuita's avatar
Camilo higuita committed
277
			leftEmblem: "list-add"
278
			showDetailsInfo: true
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
			// 			itemSize: thumbnailsSize
			model: folderModel
			section.delegate: Maui.LabelDelegate
			{
				id: delegate
				label: section
				labelTxt.font.pointSize: fontSizes.big
				
				isSection: true
				boldLabel: true
				height: toolBarHeightAlt
			}
		}
	}
	
	Component
	{
		id: gridViewBrowser
		
		Maui.GridBrowser
		{
			itemSize : thumbnailsSize + fontSizes.default
301
			showEmblem: selectionMode
302
303
			showPreviewThumbnails: modelList.preview
			rightEmblem: isMobile ? "document-share" : ""
Camilo higuita's avatar
Camilo higuita committed
304
			leftEmblem: "list-add"
305
306
307
308
309
310
311
312
			model: folderModel
		}
	}
	
	Connections
	{
		target: browser
		
313
314
315
316
317
318
		onItemClicked: 
		{		
			browser.currentIndex = index
			indexHistory.push(index)
			control.itemClicked(index)
		}
319
		
320
321
322
323
324
325
		onItemDoubleClicked: 
		{
			browser.currentIndex = index	
			indexHistory.push(index)
			control.itemDoubleClicked(index)
		}
326
327
328
		
		onItemRightClicked:
		{
Camilo higuita's avatar
Camilo higuita committed
329
			itemMenu.show([modelList.get(index)])
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
			control.itemRightClicked(index)
		}
		
		onLeftEmblemClicked:
		{
			control.addToSelection(modelList.get(index), true)
			control.itemLeftEmblemClicked(index)
		}
		
		onRightEmblemClicked:
		{
			isAndroid ? Maui.Android.shareDialog([modelList.get(index).path]) : shareDialog.show([modelList.get(index).path])
			control.itemRightEmblemClicked(index)
		}
		
		onAreaClicked:
		{
			if(!isMobile && mouse.button === Qt.RightButton)
				browserMenu.show()
				else return
					
					control.rightClicked()
		}
		
		onAreaRightClicked: browserMenu.show()
	}
	
	focus: true
	
	Maui.Holder
	{
		id: holder
		anchors.fill : parent
		z: -1
		visible: !modelList.pathExists || modelList.pathEmpty || !modelList.contentReady
		emoji: if(modelList.pathExists && modelList.pathEmpty)
Camilo higuita's avatar
Camilo higuita committed
366
367
368
		"qrc:/assets/MoonSki.png" 
		else if(!modelList.pathExists)
			"qrc:/assets/ElectricPlug.png"
369
370
			else if(!modelList.contentReady && currentPathType === FMList.SEARCH_PATH)
				"qrc:/assets/animat-search-color.gif"
Camilo higuita's avatar
Camilo higuita committed
371
372
			else if(!modelList.contentReady)
				"qrc:/assets/animat-rocket-color.gif"
373
				
Camilo higuita's avatar
Camilo higuita committed
374
375
376
377
				isGif: !modelList.contentReady			
				isMask: false
				title : if(modelList.pathExists && modelList.pathEmpty)
				qsTr("Folder is empty!")
378
				else if(!modelList.pathExists)
Camilo higuita's avatar
Camilo higuita committed
379
					qsTr("Folder doesn't exists!")
380
381
382
383
384
					else if(!modelList.contentReady && currentPathType === FMList.SEARCH_PATH)
						qsTr("Searching for content!")
						else if(!modelList.contentReady)
							qsTr("Loading content!")					
						
385
						
Camilo higuita's avatar
Camilo higuita committed
386
387
388
389
						body: if(modelList.pathExists && modelList.pathEmpty)
						qsTr("You can add new files to it")
						else if(!modelList.pathExists)
							qsTr("Create Folder?")
390
391
392
393
394
395
							else if(!modelList.contentReady && currentPathType === FMList.SEARCH_PATH)
								qsTr("This might take a while!")
								else if(!modelList.contentReady)
									qsTr("Almost ready!")	
							
								
Camilo higuita's avatar
Camilo higuita committed
396
397
398
399
400
401
402
403
404
405
406
								
								emojiSize: iconSizes.huge
								
								onActionTriggered:
								{
									if(!modelList.pathExists)
									{
										Maui.FM.createDir(control.currentPath.slice(0, control.currentPath.lastIndexOf("/")), control.currentPath.split("/").pop())
										control.openFolder(modelList.parentPath)				
									}
								}
407
408
409
410
411
412
413
	}
	
	Keys.onSpacePressed: previewer.show(modelList.get(browser.currentIndex).path)
	
	headBarExit: false
	headBar.visible: currentPathType !== FMList.APPS_PATH
	altToolBars: isMobile
414
415
416
417
	headBar.rightContent: Kirigami.ActionToolBar
	{
            Layout.fillWidth: true
        z: 999
418
419
        		hiddenActions: browserMenu.actions

420
    actions: [
421
	
422
	Kirigami.Action
423
	{
424
		iconName: list.viewType == FMList.ICON_VIEW ?  "view-list-details" : "view-list-icons"
425
		onTriggered: control.switchView()
426
427
	},
	
428
	Kirigami.Action
429
430
	{
		iconName: "view-sort"
Camilo higuita's avatar
Camilo higuita committed
431
		text: qsTr("Sort")
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
        
        Kirigami.Action
        {
            text: qsTr("Folders first")
            checked: list.foldersFirst
            onTriggered: list.foldersFirst = !list.foldersFirst
        }
        
        Kirigami.Action
        {
            text: qsTr("Type")
            checked: list.sortBy === FMList.MIME
            onTriggered: list.sortBy = FMList.MIME
        }
        
        Kirigami.Action
        {
            text: qsTr("Date")
            checked: list.sortBy === FMList.DATE
            onTriggered: list.sortBy = FMList.DATE
        }
        
        Kirigami.Action
        {
            text: qsTr("Modified")
            checked: list.sortBy === FMList.MODIFIED
            onTriggered: list.sortBy = FMList.MODIFIED
        }
        
        Kirigami.Action
        {
            text: qsTr("Size")
            checked: list.sortBy === FMList.SIZE
            onTriggered: list.sortBy = FMList.SIZE
        }
        
        Kirigami.Action
        {
            text: qsTr("Name")
            checked: list.sortBy === FMList.LABEL
            onTriggered: list.sortBy = FMList.LABEL
        }        
        
        Kirigami.Action
        {
            id: groupAction
            text: qsTr("Group")
            checked: group
            onTriggered:
            {
                group = !group
               if(group) 
                   groupBy()
                   else
                       browser.section.property = ""
            }
        }
        
490
	},
Camilo higuita's avatar
Camilo higuita committed
491
	
492
	Kirigami.Action
493
	{
494
        text: qsTr("Select")
Camilo higuita's avatar
Camilo higuita committed
495
		iconName: "item-select"
camilo higuita's avatar
camilo higuita committed
496
		checkable: false
497
		checked: selectionMode		
498
		onTriggered: selectionMode = !selectionMode
499
		
500
501
	}
	]
502
503
	

504
}
505
	
506
507
	headBar.leftContent: [
	Maui.ToolButton
508
	{
Camilo higuita's avatar
Camilo higuita committed
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
		iconName: "go-previous"
		onClicked: control.goBack()
	},
	
	Maui.ToolButton
	{
		id: goUpButton
		visible: isAndroid
		iconName: "go-up"
		onClicked: control.goUp()
	},
	
	Maui.ToolButton
	{
		iconName: "go-next"
		onClicked: control.goNext()
	}	
526
527
528
529
	]
	
	footBar.visible: false
	
530
531
532
533
534
535
536
537
	
	Component
	{
		id: selectionBarComponent
		
		Maui.SelectionBar
		{
			anchors.fill: parent
538
			onIconClicked: _selectionBarmenu.popup()
539
			onExitClicked: clearSelection()
540
			
541
			Menu
542
543
			{
				id: _selectionBarmenu
544
				MenuItem
545
546
547
548
549
550
551
552
553
554
555
556
				{
					text: qsTr("Copy...")
					onTriggered:
					{
						if(control.selectionBar)				
							control.selectionBar.animate("#6fff80")
						control.copy(selectedItems)		
						console.log(selectedItems)
						_selectionBarmenu.close()
					}
				}
				
557
				MenuItem
558
559
560
561
562
563
564
565
566
567
568
569
				{
					text: qsTr("Cut...")
					onTriggered:
					{
						if(control.selectionBar)
							control.selectionBar.animate("#fff44f")
						control.cut(selectedItems)
						
						_selectionBarmenu.close()
					}
				}
				
570
				MenuItem
571
572
573
574
575
576
577
578
579
				{
					text: qsTr("Share")
					onTriggered:
					{						
						control.shareFiles(selectedPaths)						
						_selectionBarmenu.close()
					}
				}
				
580
581
				MenuSeparator{}
				
582
				MenuItem
583
584
				{
					text: qsTr("Remove...")
585
					Kirigami.Theme.textColor: dangerColor
586
587
588
589
590
591
592
593
594
595
					
					onTriggered:
					{
						dialogLoader.sourceComponent= removeDialogComponent
						dialog.items = selectedItems
						dialog.open()
						_selectionBarmenu.close()
					}
				}
			}
596
597
598
599
600
601
602
603
604
605
606
607
608
609
		}
	}
	
	ColumnLayout
	{
		anchors.fill: parent
		visible: !holder.visible
		z: holder.z + 1
		spacing: 0
		
		Loader
		{
			id: viewLoader
			z: holder.z + 1
610
			sourceComponent: list.viewType == FMList.ICON_VIEW  ?  gridViewBrowser :  listViewBrowser
611
			
612
			Layout.margins: list.viewType == FMList.LIST_VIEW ? unit : contentMargins * 2
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
			
			Layout.fillWidth: true
			Layout.fillHeight: true
		}
		
		Loader
		{
			id: selectionBarLoader
			Layout.fillWidth: true
			Layout.preferredHeight: control.selectionBar ? (control.selectionBar.visible ? control.selectionBar.barHeight : 0) : 0
			Layout.leftMargin:  contentMargins * (isMobile ? 3 : 2)
			Layout.rightMargin: contentMargins * (isMobile ? 3 : 2)
			Layout.bottomMargin: contentMargins*2
			z: holder.z +1
		}
628
629
630
631
632
633
634
635
636
637
638
		
		
		ProgressBar
		{
			id: _progressBar
			Layout.fillWidth: true
			Layout.alignment: Qt.AlignBottom
			height: iconSizes.medium
			visible: value > 0
		}
		
639
640
	}
	
Camilo higuita's avatar
Camilo higuita committed
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
	// 	PinchArea
	// 	{
	//         anchors.fill: parent
	//         
	//         property real initialWidth
	//         property real initialHeight
	// 
	//         onPinchStarted:
	//         {
	//             console.log("pinch started")
	//         }
	// 
	//         onPinchUpdated:
	//         {
	//             console.log(pinch.scale)
	//         }
	// 
	//         onPinchFinished:
	//         {
	//             console.log("pinch finished")
	//         }
	//     }
663
	
664
665
666
667
	onThumbnailsSizeChanged:
	{
		if(trackChanges && saveDirProps)
			Maui.FM.setDirConf(currentPath+"/.directory", "MAUIFM", "IconSize", thumbnailsSize)
668
669
			else 
				Maui.FM.saveSettings("IconSize", thumbnailsSize, "SETTINGS")
670
				
Camilo higuita's avatar
Camilo higuita committed
671
				if(list.viewType == FMList.ICON_VIEW)
672
					browser.adaptGrid()
673
674
	}
	
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
	
    function shareFiles(urls)
    {
        if(urls.length <= 0)
            return;
        
        if(isAndroid)              
            Maui.Android.shareDialog(urls[0])        
        else
        {
            dialogLoader.sourceComponent= shareDialogComponent            
            dialog.show(urls)                    
        }
    }
    
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
	function openItem(index)
	{
		var item = modelList.get(index)
		var path = item.path
		
		switch(currentPathType)
		{
			case FMList.APPS_PATH:
				if(item.path.endsWith("/"))
					populate(path)
					else
						Maui.FM.runApplication(path)
						break
			case FMList.CLOUD_PATH:
				if(item.mime === "inode/directory")
					control.openFolder(path)
					else
						Maui.FM.openCloudItem(item)
						break;
			default:
				if(selectionMode && !Maui.FM.isDir(item.path))
					addToSelection(item, true)
					else
					{
						if(Maui.FM.isDir(path))
							control.openFolder(path)
							else if(Maui.FM.isApp(path))
								control.launchApp(path)
								else
								{
									if (isMobile)
										previewer.show(path)
										else
											control.openFile(path)
								}
					}
		}
	}
	
	function launchApp(path)
	{
		Maui.FM.runApplication(path, "")
	}
	
	function openFile(path)
	{
		Maui.FM.openUrl(path)
	}
	
	function openFolder(path)
	{
		populate(path)
	}
	
	function setPath(path)
	{
		currentPath = path
	}
	
	function populate(path)
	{
		if(!path.length)
			return;
753
		
754
		browser.currentIndex = 0
755
756
757
758
759
760
761
762
		setPath(path)
		
		if(currentPathType === FMList.PLACES_PATH)
		{
			if(trackChanges && saveDirProps)
			{
				var conf = Maui.FM.dirConf(path+"/.directory")
				var iconsize = conf["iconsize"] ||  iconSizes.large
763
				thumbnailsSize = parseInt(iconsize)				
764
765
			}else
			{
766
				thumbnailsSize = parseInt(Maui.FM.loadSettings("IconSize", "SETTINGS", thumbnailsSize))		
767
			}
768
769
		}
		
770
		if(list.viewType == FMList.ICON_VIEW)
771
772
773
774
775
776
			browser.adaptGrid()
	}
	
	function goBack()
	{
		populate(modelList.previousPath)
777
		browser.currentIndex = indexHistory.pop()
778
//		browser.positionViewAtIndex(browser.currentIndex, ListView.Center)
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
	}
	
	function goNext()
	{
		openFolder(modelList.posteriorPath)
	}
	
	function goUp()
	{
		openFolder(modelList.parentPath)
	}
	
	function refresh()
	{
		var pos = browser.contentY
		modelList.refresh()
		
		browser.contentY = pos
	}
	
	function addToSelection(item, append)
	{
		selectionBarLoader.sourceComponent= selectionBarComponent
		selectionBar.append(item)
	}
	
	function clearSelection()
	{
		clean()
		// 		selectionMode = false
	}
	
	function clean()
	{
Camilo higuita's avatar
Camilo higuita committed
813
814
		copyItems = []
		cutItems = []
815
		browserMenu.pasteFiles = 0
816
817
818
		
		if(control.selectionBar && control.selectionBar.visible)
			selectionBar.clear()
819
820
	}
	
Camilo higuita's avatar
Camilo higuita committed
821
	function copy(items)
822
	{
Camilo higuita's avatar
Camilo higuita committed
823
		copyItems = items
824
825
826
827
		isCut = false
		isCopy = true
	}
	
Camilo higuita's avatar
Camilo higuita committed
828
	function cut(items)
829
	{
830
		cutItems = items
831
832
833
834
835
836
837
		isCut = true
		isCopy = false
	}
	
	function paste()
	{
		if(isCopy)
Camilo higuita's avatar
Camilo higuita committed
838
			list.copyInto(copyItems, currentPath)
839
840
841
842
843
		else if(isCut)
		{
			list.cutInto(cutItems, currentPath)
			clearSelection()			
		}
844
845
	}
	
Camilo higuita's avatar
Camilo higuita committed
846
	function remove(items)
847
	{
Camilo higuita's avatar
Camilo higuita committed
848
849
		for(var i in items)
			Maui.FM.removeFile(items[i].path)
850
	}	
851
	
852
853
854
	function switchView()
	{	
		list.viewType = list.viewType ===  FMList.ICON_VIEW ? FMList.LIST_VIEW : FMList.ICON_VIEW
855
856
857
858
859
860
861
862
863
864
	}
	
	function bookmarkFolder(paths)
	{
		if(paths.length > 0)
		{
			for(var i in paths)
			{
				if(Maui.FM.isDefaultPath(paths[i]))
					continue
865
                Maui.FM.bookmark(paths[i])
866
			}
867
868
869
		}
        newBookmark()

870
871
872
	}
	
	function zoomIn()
873
874
	{		
		control.thumbnailsSize = control.thumbnailsSize + 8		
875
876
877
878
879
880
881
882
	}
	
	function zoomOut()
	{
		var newSize = control.thumbnailsSize - 8
		
		if(newSize >= iconSizes.small)
			control.thumbnailsSize = newSize
883
	}	
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
	
	function groupBy()
	{
		var prop = ""
		var criteria = ViewSection.FullString
		
		switch(modelList.sortBy)
		{
			case FMList.LABEL:
				prop = "label"
				criteria = ViewSection.FirstCharacter
				break;
			case FMList.MIME:
				prop = "mime"
				break;
			case FMList.SIZE:
				prop = "size"
				break;
			case FMList.DATE:
				prop = "date"
				break;
			case FMList.MODIFIED:
				prop = "modified"
				break;
		}
		
910
		list.viewType = FMList.LIST_VIEW 
911
912
913
914
915
916
917
918
919
920
		
		if(!prop)
		{
			browser.section.property = ""
			return
		}
		
		browser.section.property = prop
		browser.section.criteria = criteria
	}
921
}