summaryrefslogtreecommitdiff
authordwmw2 <dwmw2>2002-05-09 11:59:51 (UTC)
committer dwmw2 <dwmw2>2002-05-09 11:59:51 (UTC)
commit67077883f382bd73bf4bdceda8994fa4e47ee5e6 (patch) (unidiff)
tree66433081886ad27170f95e23ccd36d487d90c95a
parentd9b40786a885451caf3f22612ec401df1edff983 (diff)
downloadopie-67077883f382bd73bf4bdceda8994fa4e47ee5e6.zip
opie-67077883f382bd73bf4bdceda8994fa4e47ee5e6.tar.gz
opie-67077883f382bd73bf4bdceda8994fa4e47ee5e6.tar.bz2
#include <qpainter.h>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/filebrowser/filebrowser.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/noncore/unsupported/filebrowser/filebrowser.cpp b/noncore/unsupported/filebrowser/filebrowser.cpp
index 1bb7984..8c01655 100644
--- a/noncore/unsupported/filebrowser/filebrowser.cpp
+++ b/noncore/unsupported/filebrowser/filebrowser.cpp
@@ -1,108 +1,109 @@
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#include <qpe/config.h> 28#include <qpe/config.h>
29 29
30#include <qcopchannel_qws.h> 30#include <qcopchannel_qws.h>
31#include <qpe/qcopenvelope_qws.h> 31#include <qpe/qcopenvelope_qws.h>
32 32
33#include <qmessagebox.h> 33#include <qmessagebox.h>
34#include <qdir.h> 34#include <qdir.h>
35#include <qregexp.h> 35#include <qregexp.h>
36#include <qheader.h> 36#include <qheader.h>
37#include <qpe/qpetoolbar.h> 37#include <qpe/qpetoolbar.h>
38#include <qpopupmenu.h> 38#include <qpopupmenu.h>
39#include <qpe/qpemenubar.h> 39#include <qpe/qpemenubar.h>
40#include <qaction.h> 40#include <qaction.h>
41#include <qstringlist.h> 41#include <qstringlist.h>
42#include <qcursor.h> 42#include <qcursor.h>
43#include <qmultilineedit.h> 43#include <qmultilineedit.h>
44#include <qfont.h> 44#include <qfont.h>
45#include <qpainter.h>
45 46
46#include <unistd.h> 47#include <unistd.h>
47#include <stdlib.h> 48#include <stdlib.h>
48#include <sys/stat.h> 49#include <sys/stat.h>
49 50
50// 51//
51// FileItem 52// FileItem
52// 53//
53FileItem::FileItem( QListView * parent, const QFileInfo & fi ) 54FileItem::FileItem( QListView * parent, const QFileInfo & fi )
54 : QListViewItem( parent ), 55 : QListViewItem( parent ),
55 fileInfo( fi ) 56 fileInfo( fi )
56{ 57{
57 QDate d = fi.lastModified().date(); 58 QDate d = fi.lastModified().date();
58 59
59 setText( 0, fi.fileName() ); 60 setText( 0, fi.fileName() );
60 setText( 1, sizeString( fi.size() ) + " " ); 61 setText( 1, sizeString( fi.size() ) + " " );
61 setText( 2, QString().sprintf("%4d-%02d-%02d",d.year(), d.month(), d.day() ) ); 62 setText( 2, QString().sprintf("%4d-%02d-%02d",d.year(), d.month(), d.day() ) );
62 63
63 MimeType mt(fi.filePath()); 64 MimeType mt(fi.filePath());
64 65
65 if ( fi.isSymLink() ) 66 if ( fi.isSymLink() )
66 setText( 3, "symlink" ); 67 setText( 3, "symlink" );
67 else if( fi.isDir() ) 68 else if( fi.isDir() )
68 setText( 3, "directory" ); 69 setText( 3, "directory" );
69 else if( isLib() ) 70 else if( isLib() )
70 setText( 3, "library" ); 71 setText( 3, "library" );
71 else 72 else
72 setText( 3, mt.description() ); 73 setText( 3, mt.description() );
73 74
74 QPixmap pm; 75 QPixmap pm;
75 if( fi.isDir() ){ 76 if( fi.isDir() ){
76 if( !QDir( fi.filePath() ).isReadable() ) 77 if( !QDir( fi.filePath() ).isReadable() )
77 pm = Resource::loadPixmap( "lockedfolder" ); 78 pm = Resource::loadPixmap( "lockedfolder" );
78 else 79 else
79 pm = Resource::loadPixmap( "folder" ); 80 pm = Resource::loadPixmap( "folder" );
80 } 81 }
81 else if( !fi.isReadable() ) 82 else if( !fi.isReadable() )
82 pm = Resource::loadPixmap( "locked" ); 83 pm = Resource::loadPixmap( "locked" );
83 else if( isLib() ) 84 else if( isLib() )
84 pm = Resource::loadPixmap( "library" ); 85 pm = Resource::loadPixmap( "library" );
85 else 86 else
86 pm = mt.pixmap(); 87 pm = mt.pixmap();
87 if ( pm.isNull() ) 88 if ( pm.isNull() )
88 pm = Resource::loadPixmap("UnknownDocument-14"); 89 pm = Resource::loadPixmap("UnknownDocument-14");
89 if( fi.isSymLink() ){ 90 if( fi.isSymLink() ){
90 // overlay link image 91 // overlay link image
91 QPixmap lnk = Resource::loadPixmap( "filebrowser/symlink" ); 92 QPixmap lnk = Resource::loadPixmap( "filebrowser/symlink" );
92 QPainter painter( &pm ); 93 QPainter painter( &pm );
93 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk ); 94 painter.drawPixmap( pm.width()-lnk.width(), pm.height()-lnk.height(), lnk );
94 pm.setMask( pm.createHeuristicMask( FALSE ) ); 95 pm.setMask( pm.createHeuristicMask( FALSE ) );
95 } 96 }
96 setPixmap(0,pm); 97 setPixmap(0,pm);
97} 98}
98 99
99QString FileItem::sizeString( unsigned int s ) 100QString FileItem::sizeString( unsigned int s )
100{ 101{
101 double size = s; 102 double size = s;
102 103
103 if ( size > 1024 * 1024 * 1024 ) 104 if ( size > 1024 * 1024 * 1024 )
104 return QString().sprintf( "%.1f", size / ( 1024 * 1024 * 1024 ) ) + "G"; 105 return QString().sprintf( "%.1f", size / ( 1024 * 1024 * 1024 ) ) + "G";
105 else if ( size > 1024 * 1024 ) 106 else if ( size > 1024 * 1024 )
106 return QString().sprintf( "%.1f", size / ( 1024 * 1024 ) ) + "M"; 107 return QString().sprintf( "%.1f", size / ( 1024 * 1024 ) ) + "M";
107 else if ( size > 1024 ) 108 else if ( size > 1024 )
108 return QString().sprintf( "%.1f", size / ( 1024 ) ) + "K"; 109 return QString().sprintf( "%.1f", size / ( 1024 ) ) + "K";