kfile.h
00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2000 Carsten Pfeiffer <pfeiffer@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 version 2, License as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00016 Boston, MA 02110-1301, USA. 00017 */ 00018 #ifndef KFILE_H 00019 #define KFILE_H 00020 00021 #include <qdir.h> 00022 00023 #include "kdelibs_export.h" 00024 00031 class KIO_EXPORT KFile 00032 { 00033 public: 00042 enum Mode { 00043 File = 1, 00044 Directory = 2, 00045 Files = 4, 00046 ExistingOnly = 8, 00047 LocalOnly = 16, 00048 ModeMax = 65536 00049 }; 00050 00051 enum FileView { 00052 Default = 0, 00053 Simple = 1, 00054 Detail = 2, 00055 SeparateDirs = 4, 00056 PreviewContents = 8, 00057 PreviewInfo = 16, 00058 FileViewMax = 65536 00059 }; 00060 00061 enum SelectionMode { 00062 Single = 1, 00063 Multi = 2, 00064 Extended = 4, 00065 NoSelection = 8 00066 }; 00067 00068 00069 // 00070 // some bittests 00071 // 00072 00073 00074 // sorting specific 00075 00076 // grr, who had the idea to set QDir::Name to 0x0? 00077 static bool isSortByName( const QDir::SortSpec& sort ) { 00078 return (sort & QDir::Time) != QDir::Time && 00079 (sort & QDir::Size) != QDir::Size; 00080 } 00081 00082 static bool isSortBySize( const QDir::SortSpec& sort ) { 00083 return (sort & QDir::Size) == QDir::Size; 00084 } 00085 00086 static bool isSortByDate( const QDir::SortSpec& sort ) { 00087 return (sort & QDir::Time) == QDir::Time; 00088 } 00089 00090 static bool isSortDirsFirst( const QDir::SortSpec& sort ) { 00091 return (sort & QDir::DirsFirst) == QDir::DirsFirst; 00092 } 00093 00094 static bool isSortCaseInsensitive( const QDir::SortSpec& sort ) { 00095 return (sort & QDir::IgnoreCase) == QDir::IgnoreCase; 00096 } 00097 00098 00099 // view specific 00100 static bool isDefaultView( const FileView& view ) { 00101 return (view & Default) == Default; 00102 } 00103 00104 static bool isSimpleView( const FileView& view ) { 00105 return (view & Simple) == Simple; 00106 } 00107 00108 static bool isDetailView( const FileView& view ) { 00109 return (view & Detail) == Detail; 00110 } 00111 00112 static bool isSeparateDirs( const FileView& view ) { 00113 return (view & SeparateDirs) == SeparateDirs; 00114 } 00115 00116 static bool isPreviewContents( const FileView& view ) { 00117 return (view & PreviewContents) == PreviewContents; 00118 } 00119 00123 static bool isPreviewInfo( const FileView& view ) { 00124 return (view & PreviewInfo) == PreviewInfo; 00125 } 00126 00127 }; 00128 00129 #endif // KFILE_H