[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/graphics/UNNAMED_READER
From:       Stefan Kebekus <kebekus () kde ! org>
Date:       2007-01-11 7:48:34
Message-ID: 1168501714.455710.28060.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 622254 by kebekus:

automatically generate the desktop file for the standalone-viewer by inserting a list \
of supported mime types into a template


 M  +21 -3     UNNAMED_READER/CMakeLists.txt  
 D             UNNAMED_READER/TODO  
 A             UNNAMED_READER/UNNAMED_READER-desktopTemplate.desktop   \
UNNAMED_READER/UNNAMED_READER.desktop#619739  D             \
UNNAMED_READER/UNNAMED_READER.desktop    A             UNNAMED_READER/dummy.cpp   \
[License: no copyright]  A             UNNAMED_READER/generateDesktopFile.cpp   \
[License: GPL (v2+) (wrong address)]  M  +22 -3     corelibrary/fileFormats.cpp  
 M  +12 -2     corelibrary/fileFormats.h  


--- trunk/playground/graphics/UNNAMED_READER/UNNAMED_READER/CMakeLists.txt \
#622253:622254 @@ -3,6 +3,7 @@
 
 add_subdirectory( pics )
 
+
 ########### UNNAMED_READER ###############
 
 set(UNNAMED_READER_SRCS
@@ -17,18 +18,35 @@
 
 kde4_add_ui_files(UNNAMED_READER_SRCS settingsWidget.ui )
 
+ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/desktopDummy.cpp
+                   COMMAND generateDesktopFile \
${CMAKE_CURRENT_SOURCE_DIR}/UNNAMED_READER-desktopTemplate.desktop \
${CMAKE_CURRENT_BINARY_DIR}/UNNAMED_READER.desktop +		   COMMAND cp \
${CMAKE_CURRENT_SOURCE_DIR}/dummy.cpp ${CMAKE_CURRENT_BINARY_DIR}/desktopDummy.cpp) \
+SET(UNNAMED_READER_SRCS ${UNNAMED_READER_SRCS} \
${CMAKE_CURRENT_BINARY_DIR}/desktopDummy.cpp) +
 kde4_automoc(${UNNAMED_READER_SRCS})
  
 kde4_add_executable(UNNAMED_READER ${UNNAMED_READER_SRCS})
 
 target_link_libraries(UNNAMED_READER UNNAMED_READERcore ${KDE4_KDECORE_LIBS} \
${KDE4_KPARTS_LIBS} )  
-install(TARGETS UNNAMED_READER DESTINATION ${BIN_INSTALL_DIR} )
+install(TARGETS UNNAMED_READER DESTINATION ${BIN_INSTALL_DIR})
 
+ADD_DEPENDENCIES(UNNAMED_READER generateDesktopFile)
 
+
+########### generateDesktopFile ###############
+
+set(GENERATEDESKTOP_SRCS
+	generateDesktopFile.cpp)
+
+kde4_add_executable(generateDesktopFile ${GENERATEDESKTOP_SRCS})
+
+target_link_libraries(generateDesktopFile UNNAMED_READERcore ${KDE4_KDECORE_LIBS} \
${KDE4_KPARTS_LIBS}) +
+
 ########### install files ###############
 
-install( FILES UNNAMED_READER.desktop  DESTINATION  ${XDG_APPS_DIR} )
-#install( FILES UNNAMED_READER.kcfg  DESTINATION  ${KCFG_INSTALL_DIR} )
+install( FILES ${CMAKE_CURRENT_BINARY_DIR}/UNNAMED_READER.desktop  DESTINATION  \
${XDG_APPS_DIR} ) +install( FILES UNNAMED_READERPrefs.kcfg  DESTINATION  \
${KCFG_INSTALL_DIR} )  install( FILES UNNAMED_READERui.rc  DESTINATION  \
${DATA_INSTALL_DIR}/UNNAMED_READER )  install( FILES tips DESTINATION  \
                ${DATA_INSTALL_DIR}/UNNAMED_READER )
--- trunk/playground/graphics/UNNAMED_READER/corelibrary/fileFormats.cpp \
#622253:622254 @@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2003-2006 by Stefan Kebekus <kebekus@kde.org>           *
+ *   Copyright (C) 2003-2007 by Stefan Kebekus <kebekus@kde.org>           *
  *   Copyright (C) 2006 by Wilfried Huss                                   *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
@@ -19,8 +19,6 @@
  ***************************************************************************/
 
 
-#include <config.h>
-
 #include "fileFormats.h"
 #include "UNNAMED_READER_debug.h"
 
@@ -30,6 +28,17 @@
 namespace UNNAMED_READER {
 
 
+// List of supported mime types and associated libraries.
+
+char *supportedMimeTypes_strings[] = 
+{
+  "image/tiff", "UNNAMED_READER_TIFF_plugin",
+  "application/pdf", "UNNAMED_READER_PDF_plugin",
+  0
+};
+
+
+
 bool fileFormats::UrlQuickCheckForSupportedFormat(KUrl url)
 {
   kDebug(UNNAMED_READER_DEBUG, shell) << \
"fileFormats::UrlQuickCheckForSupportedFormat(" << url << ")" << endl; @@ -55,5 \
+64,15 @@  return false;
 }
 
+
+QStringList fileFormats::supportedMimeTypes() 
+{
+  QStringList types;
+  for(int i=0; supportedMimeTypes_strings[i] != 0; i++)
+    if (i%2 == 0)
+      types << supportedMimeTypes_strings[i];
+  return types;
+}
+
 } // namespace UNNAMED_READER
 
--- trunk/playground/graphics/UNNAMED_READER/corelibrary/fileFormats.h #622253:622254
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2006 by Stefan Kebekus <kebekus@kde.org>                *
+ *   Copyright (C) 2006--2007 by Stefan Kebekus <kebekus@kde.org>          *
  *   Copyright (C) 2006 by Wilfried Huss                                   *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
@@ -23,6 +23,7 @@
 #define _FILEFORMATS_
 
 #include <kurl.h>
+#include <QStringList>
 
 
 namespace UNNAMED_READER {
@@ -39,6 +40,7 @@
 class KDE_EXPORT fileFormats
 {
  public:
+  fileFormats();
 
   /**
    * quick check if URL points to a supported file
@@ -49,9 +51,17 @@
    * the supported endings
    */
   static bool UrlQuickCheckForSupportedFormat(KUrl url);
+
+  /**
+   * List of supported mime types
+   *
+   * Returns a list of supported mime types. Entry 2n is the name of
+   * the mime type, entry 2n+1 is the name of the library that
+   * contains the plugin.
+   */ 
+  static QStringList supportedMimeTypes();
 };
 
-
 } // namespace UNNAMED_READER
 
 #endif


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic