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

List:       kde-commits
Subject:    KDE/kdegraphics/ksnapshot
From:       Pau Garcia i Quiles <pgquiles () elpauer ! org>
Date:       2010-11-09 3:10:48
Message-ID: 20101109031048.7E6C0AC89B () svn ! kde ! org
[Download RAW message or body]

SVN commit 1194476 by pgquiles:

Add support for KIPI plugins. At this moment, only the Facebook export plugin works.

 M  +18 -0     CMakeLists.txt  
 M  +3 -0      config-ksnapshot.h.cmake  
 A             kipiaction.cpp   [License: GPL (v2+)]
 A             kipiaction.h   [License: GPL (v2+)]
 A             kipiinterface.cpp   [License: LGPL (v2+)]
 A             kipiinterface.h   [License: LGPL (v2+)]
 M  +27 -2     ksnapshot.cpp  
 M  +19 -0     ksnapshot.h  
 A             ksnapshotimagecollectionshared.cpp   [License: LGPL (v2+)]
 A             ksnapshotimagecollectionshared.h   [License: LGPL (v2+)]
 A             ksnapshotinfoshared.cpp   [License: LGPL (v2+)]
 A             ksnapshotinfoshared.h   [License: LGPL (v2+)]
 A             ksnapshotjobtracker.cpp   [License: GPL (v2+)]
 A             ksnapshotjobtracker.h   [License: GPL (v2+)]
 M  +2 -2      ksnapshotwidget.ui  


--- trunk/KDE/kdegraphics/ksnapshot/CMakeLists.txt #1194475:1194476
@@ -6,6 +6,10 @@
 set(HAVE_X11_EXTENSIONS_XFIXES_H X11_Xfixes_FOUND)
 macro_log_feature(HAVE_X11_EXTENSIONS_XFIXES_H "X11 Fixes Extension (xfixes.h)" "X11 \
XFixes Extension" "http://www.x.org/" FALSE "" "Needed to capture the cursor in \
ksnapshot.")  
+if (KIPI_FOUND)
+        include_directories(${KIPI_INCLUDE_DIR})
+endif (KIPI_FOUND)
+
 configure_file(config-ksnapshot.h.cmake \
${CMAKE_CURRENT_BINARY_DIR}/config-ksnapshot.h)  
 ########### next target ###############
@@ -24,6 +28,16 @@
    ksnapshot.cpp 
    ${ksnapshot_file_SRCS})
 
+if (KIPI_FOUND)
+set(ksnapshot_SRCS
+    kipiaction.cpp
+    kipiinterface.cpp
+    ksnapshotimagecollectionshared.cpp
+    ksnapshotinfoshared.cpp
+    ksnapshotjobtracker.cpp
+    ${ksnapshot_SRCS})
+endif (KIPI_FOUND)
+
 qt4_add_dbus_adaptor(ksnapshot_SRCS org.kde.ksnapshot.xml ksnapshot.h KSnapshot)
 
 
@@ -39,6 +53,10 @@
     target_link_libraries(ksnapshot ${X11_Xfixes_LIB})
 endif (X11_Xfixes_FOUND)
 
+if (KIPI_FOUND)
+    target_link_libraries(ksnapshot ${KIPI_LIBRARIES})
+endif (KIPI_FOUND)
+
 install(TARGETS ksnapshot ${INSTALL_TARGETS_DEFAULT_ARGS})
 
 
--- trunk/KDE/kdegraphics/ksnapshot/config-ksnapshot.h.cmake #1194475:1194476
@@ -3,3 +3,6 @@
 
 /* Define to 1 if you have the <X11/extensions/Xfixes.h> header file. */
 #cmakedefine HAVE_X11_EXTENSIONS_XFIXES_H 1
+
+/* Define to 1 if you have libkipi */
+#cmakedefine KIPI_FOUND 1
--- trunk/KDE/kdegraphics/ksnapshot/ksnapshot.cpp #1194475:1194476
@@ -69,7 +69,12 @@
 #include "ksnapshotpreview.h"
 #include "ui_ksnapshotwidget.h"
 
-#include <config-ksnapshot.h>
+#ifdef KIPI_FOUND
+#include <libkipi/plugin.h>
+#include "kipiinterface.h"
+#include "kipiaction.h"
+#include <KAction>
+#endif
 
 #ifdef HAVE_X11_EXTENSIONS_XFIXES_H
 #include <X11/extensions/Xfixes.h>
@@ -96,7 +101,7 @@
     setButtons(Help | Apply | User1 | User2);
     setButtonGuiItem(Apply, KStandardGuiItem::saveAs());
     setButtonGuiItem(User1, KGuiItem(i18n("Copy"), "edit-copy"));
-    setButtonGuiItem(User2, KGuiItem(i18n("Open With..."), "document-open"));
+    setButtonGuiItem(User2, KGuiItem(i18n("Send To..."), "document-open"));
     setDefaultButton(Apply);
     grabber = new QWidget( 0,  Qt::X11BypassWindowManagerHint );
     grabber->move( -1000, -1000 );
@@ -132,6 +137,12 @@
 
     KConfigGroup conf(KGlobal::config(), "GENERAL");
 
+#ifdef KIPI_FOUND
+    mPluginLoader = new KIPI::PluginLoader(QStringList(), new KIPIInterface(this), \
""); +
+    mTracker=new KSnapshotJobTracker(/*statusBar()*/ this);
+#endif
+
 #ifdef HAVE_X11_EXTENSIONS_XFIXES_H
     {
         int tmp1, tmp2;
@@ -475,6 +486,20 @@
                                                        name, this));
     }
 
+
+#ifdef KIPI_FOUND
+    // Add KIPI plugins
+    Q_FOREACH(KIPI::PluginLoader::Info* pluginInfo, mPluginLoader->pluginList()) {
+        QStringList pluginMime = \
pluginInfo->service()->property("X-KIPI-Mimetypes").toStringList(); +        \
foreach(const QString& supportedPlugin, pluginMime) { +            \
Q_UNUSED(supportedPlugin); +            KipiAction* action=new KipiAction(pluginInfo, \
this, openMenu); +            openMenu->addAction(action);
+            break; // If a plugin supports more than one MIME type, add the plugin \
only once, not once per MIME type +        }
+    }
+#endif
+
     openMenu->addSeparator();
     KService::Ptr none;
     openMenu->addAction(new KSnapshotServiceAction(none,
--- trunk/KDE/kdegraphics/ksnapshot/ksnapshot.h #1194475:1194476
@@ -35,10 +35,19 @@
 #include <kurl.h>
 #include "ksnapshotobject.h"
 #include "snapshottimer.h"
+#include "kipiaction.h"
+#include "ksnapshotimagecollectionshared.h"
 
+#include <config-ksnapshot.h>
+
 class KSnapshotWidget;
 class QMenu;
 
+#ifdef KIPI_FOUND
+#include <libkipi/pluginloader.h>
+#include "ksnapshotjobtracker.h"
+#endif
+
 class KSnapshotServiceAction : public QAction
 {
     Q_OBJECT
@@ -69,6 +78,10 @@
 
     QString url() const { return filename.url(); }
 
+#ifdef KIPI_FOUND
+    KSnapshotJobTracker* tracker() const { return mTracker; }
+#endif
+
 public slots:
     void slotGrab();
     void slotSave();
@@ -132,6 +145,12 @@
     QPoint savedPosition;
     bool haveXFixes;
     bool includeAlpha;
+#ifdef KIPI_FOUND
+    KIPI::PluginLoader* mPluginLoader;
+    KSnapshotJobTracker* mTracker;
+    friend void KipiAction::runJob();
+    friend KUrl::List KSnapshotImageCollectionShared::images();
+#endif
 };
 
 #endif // KSNAPSHOT_H
--- trunk/KDE/kdegraphics/ksnapshot/ksnapshotwidget.ui #1194475:1194476
@@ -126,12 +126,12 @@
        </item>
        <item>
         <property name="text">
-         <string>Region</string>
+         <string>Rectangular Region</string>
         </property>
        </item>
        <item>
         <property name="text">
-         <string>Free Region</string>
+         <string>Freehand Region</string>
         </property>
        </item>
        <item>


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

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