summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-02-24 18:32:43 (UTC)
committer llornkcor <llornkcor>2002-02-24 18:32:43 (UTC)
commitade25ac278169f0e0c9ee0771e754adb46cf7ce2 (patch) (side-by-side diff)
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 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "inlineedit.h"
#include "filebrowser.h"
#include "filePermissions.h"
#include <qpe/resource.h>
#include <qpe/global.h>
#include <qpe/mimetype.h>
#include <qpe/applnk.h>
#include <qcopchannel_qws.h>
-#include <qcopenvelope_qws.h>
+#include <qpe/qcopenvelope_qws.h>
#include <qmessagebox.h>
#include <qdir.h>
#include <qregexp.h>
#include <qheader.h>
#include <qpe/qpetoolbar.h>
#include <qpopupmenu.h>
#include <qpe/qpemenubar.h>
#include <qaction.h>
#include <qstringlist.h>
#include <qcursor.h>
#include <qmultilineedit.h>
#include <qfont.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/stat.h>
//
// FileItem
//
FileItem::FileItem( QListView * parent, const QFileInfo & fi )
: QListViewItem( parent ),
fileInfo( fi )
{
QDate d = fi.lastModified().date();
setText( 0, fi.fileName() );
setText( 1, sizeString( fi.size() ) + " " );
setText( 2, QString().sprintf("%4d-%02d-%02d",d.year(), d.month(), d.day() ) );
MimeType mt(fi.filePath());
if( fi.isDir() )
setText( 3, "directory" );
else if( isLib() )
setText( 3, "library" );
else
setText( 3, mt.description() );
QPixmap pm;
if( fi.isDir() ){
if( !QDir( fi.filePath() ).isReadable() )
pm = Resource::loadPixmap( "lockedfolder" );
else
pm = Resource::loadPixmap( "folder" );
}
else if( !fi.isReadable() )
pm = Resource::loadPixmap( "locked" );
else if( isLib() )
pm = Resource::loadPixmap( "library" );
else
pm = mt.pixmap();
if ( pm.isNull() )
pm = Resource::loadPixmap("UnknownDocument-14");
setPixmap(0,pm);
}
QString FileItem::sizeString( unsigned int s )
{
double size = s;
if ( size > 1024 * 1024 * 1024 )
return QString().sprintf( "%.1f", size / ( 1024 * 1024 * 1024 ) ) + "G";
else if ( size > 1024 * 1024 )
return QString().sprintf( "%.1f", size / ( 1024 * 1024 ) ) + "M";
else if ( size > 1024 )
return QString().sprintf( "%.1f", size / ( 1024 ) ) + "K";
else
return QString::number( size ) + "B";
}
QString FileItem::key( int column, bool ascending ) const
{
QString tmp;
ascending = ascending;
if( (column == 0) && fileInfo.isDir() ){ // Sort by name
// We want the directories to appear at the top of the list
tmp = (char) 0;
return (tmp + text( column ).lower());
}
else if( column == 2 ) { // Sort by date
QDateTime epoch( QDate( 1980, 1, 1 ) );
tmp.sprintf( "%08d", epoch.secsTo( fileInfo.lastModified() ) );
return tmp;
}
else if( column == 1 ) { // Sort by size
return tmp.sprintf( "%08d", fileInfo.size() );
}
return text( column ).lower();
}
bool FileItem::isLib()