summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-02-24 18:32:43 (UTC)
committer llornkcor <llornkcor>2002-02-24 18:32:43 (UTC)
commitade25ac278169f0e0c9ee0771e754adb46cf7ce2 (patch) (unidiff)
treebed5d735366cd6cc1a86e35d9227eeee7469f04f
parent322012c251740f680055c27a96aa998fbce188ca (diff)
downloadopie-ade25ac278169f0e0c9ee0771e754adb46cf7ce2.zip
opie-ade25ac278169f0e0c9ee0771e754adb46cf7ce2.tar.gz
opie-ade25ac278169f0e0c9ee0771e754adb46cf7ce2.tar.bz2
whatever
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/filebrowser/filebrowser.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/unsupported/filebrowser/filebrowser.cpp b/noncore/unsupported/filebrowser/filebrowser.cpp
index 10dff07..41e7634 100644
--- a/noncore/unsupported/filebrowser/filebrowser.cpp
+++ b/noncore/unsupported/filebrowser/filebrowser.cpp
@@ -1,126 +1,126 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "inlineedit.h" 21#include "inlineedit.h"
22#include "filebrowser.h" 22#include "filebrowser.h"
23#include "filePermissions.h" 23#include "filePermissions.h"
24#include <qpe/resource.h> 24#include <qpe/resource.h>
25#include <qpe/global.h> 25#include <qpe/global.h>
26#include <qpe/mimetype.h> 26#include <qpe/mimetype.h>
27#include <qpe/applnk.h> 27#include <qpe/applnk.h>
28 28
29#include <qcopchannel_qws.h> 29#include <qcopchannel_qws.h>
30#include <qcopenvelope_qws.h> 30#include <qpe/qcopenvelope_qws.h>
31 31
32#include <qmessagebox.h> 32#include <qmessagebox.h>
33#include <qdir.h> 33#include <qdir.h>
34#include <qregexp.h> 34#include <qregexp.h>
35#include <qheader.h> 35#include <qheader.h>
36#include <qpe/qpetoolbar.h> 36#include <qpe/qpetoolbar.h>
37#include <qpopupmenu.h> 37#include <qpopupmenu.h>
38#include <qpe/qpemenubar.h> 38#include <qpe/qpemenubar.h>
39#include <qaction.h> 39#include <qaction.h>
40#include <qstringlist.h> 40#include <qstringlist.h>
41#include <qcursor.h> 41#include <qcursor.h>
42#include <qmultilineedit.h> 42#include <qmultilineedit.h>
43#include <qfont.h> 43#include <qfont.h>
44 44
45#include <unistd.h> 45#include <unistd.h>
46#include <stdlib.h> 46#include <stdlib.h>
47#include <sys/stat.h> 47#include <sys/stat.h>
48 48
49// 49//
50// FileItem 50// FileItem
51// 51//
52FileItem::FileItem( QListView * parent, const QFileInfo & fi ) 52FileItem::FileItem( QListView * parent, const QFileInfo & fi )
53 : QListViewItem( parent ), 53 : QListViewItem( parent ),
54 fileInfo( fi ) 54 fileInfo( fi )
55{ 55{
56 QDate d = fi.lastModified().date(); 56 QDate d = fi.lastModified().date();
57 57
58 setText( 0, fi.fileName() ); 58 setText( 0, fi.fileName() );
59 setText( 1, sizeString( fi.size() ) + " " ); 59 setText( 1, sizeString( fi.size() ) + " " );
60 setText( 2, QString().sprintf("%4d-%02d-%02d",d.year(), d.month(), d.day() ) ); 60 setText( 2, QString().sprintf("%4d-%02d-%02d",d.year(), d.month(), d.day() ) );
61 61
62 MimeType mt(fi.filePath()); 62 MimeType mt(fi.filePath());
63 63
64 if( fi.isDir() ) 64 if( fi.isDir() )
65 setText( 3, "directory" ); 65 setText( 3, "directory" );
66 else if( isLib() ) 66 else if( isLib() )
67 setText( 3, "library" ); 67 setText( 3, "library" );
68 else 68 else
69 setText( 3, mt.description() ); 69 setText( 3, mt.description() );
70 70
71 QPixmap pm; 71 QPixmap pm;
72 if( fi.isDir() ){ 72 if( fi.isDir() ){
73 if( !QDir( fi.filePath() ).isReadable() ) 73 if( !QDir( fi.filePath() ).isReadable() )
74 pm = Resource::loadPixmap( "lockedfolder" ); 74 pm = Resource::loadPixmap( "lockedfolder" );
75 else 75 else
76 pm = Resource::loadPixmap( "folder" ); 76 pm = Resource::loadPixmap( "folder" );
77 } 77 }
78 else if( !fi.isReadable() ) 78 else if( !fi.isReadable() )
79 pm = Resource::loadPixmap( "locked" ); 79 pm = Resource::loadPixmap( "locked" );
80 else if( isLib() ) 80 else if( isLib() )
81 pm = Resource::loadPixmap( "library" ); 81 pm = Resource::loadPixmap( "library" );
82 else 82 else
83 pm = mt.pixmap(); 83 pm = mt.pixmap();
84 if ( pm.isNull() ) 84 if ( pm.isNull() )
85 pm = Resource::loadPixmap("UnknownDocument-14"); 85 pm = Resource::loadPixmap("UnknownDocument-14");
86 setPixmap(0,pm); 86 setPixmap(0,pm);
87} 87}
88 88
89QString FileItem::sizeString( unsigned int s ) 89QString FileItem::sizeString( unsigned int s )
90{ 90{
91 double size = s; 91 double size = s;
92 92
93 if ( size > 1024 * 1024 * 1024 ) 93 if ( size > 1024 * 1024 * 1024 )
94 return QString().sprintf( "%.1f", size / ( 1024 * 1024 * 1024 ) ) + "G"; 94 return QString().sprintf( "%.1f", size / ( 1024 * 1024 * 1024 ) ) + "G";
95 else if ( size > 1024 * 1024 ) 95 else if ( size > 1024 * 1024 )
96 return QString().sprintf( "%.1f", size / ( 1024 * 1024 ) ) + "M"; 96 return QString().sprintf( "%.1f", size / ( 1024 * 1024 ) ) + "M";
97 else if ( size > 1024 ) 97 else if ( size > 1024 )
98 return QString().sprintf( "%.1f", size / ( 1024 ) ) + "K"; 98 return QString().sprintf( "%.1f", size / ( 1024 ) ) + "K";
99 else 99 else
100 return QString::number( size ) + "B"; 100 return QString::number( size ) + "B";
101} 101}
102 102
103QString FileItem::key( int column, bool ascending ) const 103QString FileItem::key( int column, bool ascending ) const
104{ 104{
105 QString tmp; 105 QString tmp;
106 106
107 ascending = ascending; 107 ascending = ascending;
108 108
109 if( (column == 0) && fileInfo.isDir() ){ // Sort by name 109 if( (column == 0) && fileInfo.isDir() ){ // Sort by name
110 // We want the directories to appear at the top of the list 110 // We want the directories to appear at the top of the list
111 tmp = (char) 0; 111 tmp = (char) 0;
112 return (tmp + text( column ).lower()); 112 return (tmp + text( column ).lower());
113 } 113 }
114 else if( column == 2 ) { // Sort by date 114 else if( column == 2 ) { // Sort by date
115 QDateTime epoch( QDate( 1980, 1, 1 ) ); 115 QDateTime epoch( QDate( 1980, 1, 1 ) );
116 tmp.sprintf( "%08d", epoch.secsTo( fileInfo.lastModified() ) ); 116 tmp.sprintf( "%08d", epoch.secsTo( fileInfo.lastModified() ) );
117 return tmp; 117 return tmp;
118 } 118 }
119 else if( column == 1 ) { // Sort by size 119 else if( column == 1 ) { // Sort by size
120 return tmp.sprintf( "%08d", fileInfo.size() ); 120 return tmp.sprintf( "%08d", fileInfo.size() );
121 } 121 }
122 122
123 return text( column ).lower(); 123 return text( column ).lower();
124} 124}
125 125
126bool FileItem::isLib() 126bool FileItem::isLib()