home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kfile.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  3.3 KB  |  130 lines

  1. /* This file is part of the KDE libraries
  2.     Copyright (C) 2000 Carsten Pfeiffer <pfeiffer@kde.org>
  3.  
  4.     This library is free software; you can redistribute it and/or
  5.     modify it under the terms of the GNU Library General Public
  6.     version 2, License as published by the Free Software Foundation.
  7.  
  8.     This library is distributed in the hope that it will be useful,
  9.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  11.     Library General Public License for more details.
  12.  
  13.     You should have received a copy of the GNU Library General Public License
  14.     along with this library; see the file COPYING.LIB.  If not, write to
  15.     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  16.     Boston, MA 02110-1301, USA.
  17. */
  18. #ifndef KFILE_H
  19. #define KFILE_H
  20.  
  21. #include <qdir.h>
  22.  
  23. #include "kdelibs_export.h"
  24.  
  25. /**
  26.  * KFile is a class which provides a namespace for some enumerated
  27.  * values associated with the kfile library.  You will never need to
  28.  * construct a KFile object itself.
  29.  */
  30.  
  31. class KIO_EXPORT KFile
  32. {
  33. public:
  34.     /**
  35.      * Modes of operation for the dialog.
  36.      * @li @p File - Get a single file name from the user.
  37.      * @li @p Directory - Get a directory name from the user.
  38.      * @li @p Files - Get multiple file names from the user.
  39.      * @li @p ExistingOnly - Never return a filename which does not exist yet
  40.      * @li @p LocalOnly - Don't return remote filenames
  41.      */
  42.     enum Mode {
  43.     File         = 1,
  44.     Directory    = 2,
  45.     Files        = 4,
  46.     ExistingOnly = 8,
  47.     LocalOnly    = 16,
  48.         ModeMax      = 65536
  49.     };
  50.  
  51.     enum FileView {
  52.     Default         = 0,
  53.     Simple          = 1,
  54.     Detail          = 2,
  55.     SeparateDirs    = 4,
  56.     PreviewContents = 8,
  57.     PreviewInfo     = 16,
  58.         FileViewMax     = 65536
  59.     };
  60.  
  61.     enum SelectionMode {
  62.     Single      = 1,
  63.     Multi       = 2,
  64.     Extended    = 4,
  65.     NoSelection = 8
  66.     };
  67.  
  68.  
  69.     //
  70.     // some bittests
  71.     //
  72.  
  73.  
  74.     // sorting specific
  75.  
  76.     // grr, who had the idea to set QDir::Name to 0x0?
  77.     static bool isSortByName( const QDir::SortSpec& sort ) {
  78.     return (sort & QDir::Time) != QDir::Time &&
  79.            (sort & QDir::Size) != QDir::Size;
  80.     }
  81.  
  82.     static bool isSortBySize( const QDir::SortSpec& sort ) {
  83.     return (sort & QDir::Size) == QDir::Size;
  84.     }
  85.  
  86.     static bool isSortByDate( const QDir::SortSpec& sort ) {
  87.     return (sort & QDir::Time) == QDir::Time;
  88.     }
  89.  
  90.     static bool isSortDirsFirst( const QDir::SortSpec& sort ) {
  91.     return (sort & QDir::DirsFirst) == QDir::DirsFirst;
  92.     }
  93.  
  94.     static bool isSortCaseInsensitive( const QDir::SortSpec& sort ) {
  95.     return (sort & QDir::IgnoreCase) == QDir::IgnoreCase;
  96.     }
  97.  
  98.  
  99.     // view specific
  100.     static bool isDefaultView( const FileView& view ) {
  101.     return (view & Default) == Default;
  102.     }
  103.  
  104.     static bool isSimpleView( const FileView& view ) {
  105.     return (view & Simple) == Simple;
  106.     }
  107.  
  108.     static bool isDetailView( const FileView& view ) {
  109.     return (view & Detail) == Detail;
  110.     }
  111.  
  112.     static bool isSeparateDirs( const FileView& view ) {
  113.     return (view & SeparateDirs) == SeparateDirs;
  114.     }
  115.  
  116.     static bool isPreviewContents( const FileView& view ) {
  117.     return (view & PreviewContents) == PreviewContents;
  118.     }
  119.  
  120.     /**
  121.      * @since 3.1
  122.      */
  123.     static bool isPreviewInfo( const FileView& view ) {
  124.         return (view & PreviewInfo) == PreviewInfo;
  125.     }
  126.  
  127. };
  128.  
  129. #endif // KFILE_H
  130.