• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

UNNAMED_READER/corelibrary

fileFormats.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2003-2007 by Stefan Kebekus <kebekus@kde.org>           *
00003  *   Copyright (C) 2006 by Wilfried Huss                                   *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 
00021 
00022 #include "fileFormats.h"
00023 #include "UNNAMED_READER_debug.h"
00024 
00025 #define UNNAMED_READER_DEBUG 0
00026 
00027 
00028 namespace UNNAMED_READER {
00029 
00030 
00031 // List of supported mime types and associated libraries.
00032 
00033 char *supportedMimeTypes_strings[] = 
00034 {
00035   "image/tiff", "UNNAMED_READER_TIFF_plugin",
00036   "application/pdf", "UNNAMED_READER_PDF_plugin",
00037   0
00038 };
00039 
00040 
00041 
00042 bool fileFormats::UrlQuickCheckForSupportedFormat(KUrl url)
00043 {
00044   kDebug(UNNAMED_READER_DEBUG, shell) << "fileFormats::UrlQuickCheckForSupportedFormat(" << url << ")" << endl;
00045 
00046   // Invalid URL? Not supported.
00047   if (!url.isValid() || url.isEmpty())
00048     return false;
00049   
00050   // Non-local URLs are supported
00051   if (!url.isLocalFile())
00052     return true;
00053 
00054   // Compressed files are accepted --you'll never know what they
00055   // contain unless you uncompress
00056   if (url.fileName().endsWith(".gz"))
00057     return true;
00058   if (url.fileName().endsWith(".bz2"))
00059     return true;
00060 
00061   if (url.fileName().endsWith(".pdf"))
00062     return true;
00063 
00064   return false;
00065 }
00066 
00067 
00068 QStringList fileFormats::supportedMimeTypes() 
00069 {
00070   QStringList types;
00071   for(int i=0; supportedMimeTypes_strings[i] != 0; i++)
00072     if (i%2 == 0)
00073       types << supportedMimeTypes_strings[i];
00074   return types;
00075 }
00076 
00077 } // namespace UNNAMED_READER
00078 

UNNAMED_READER/corelibrary

Skip menu "UNNAMED_READER/corelibrary"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  •   corelibrary
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal